Revert "api/schema.rs: avoid Option(Option( nesting"
This reverts commit ffdac1af01
.
This commit is contained in:
parent
ca3d861513
commit
80f069656d
@ -281,17 +281,7 @@ impl ObjectSchema {
|
||||
}
|
||||
|
||||
pub fn optional<S: Into<Arc<Schema>>>(mut self, name: &'static str, schema: S) -> Self {
|
||||
let schema = schema.into();
|
||||
let is_option = match schema.as_ref() {
|
||||
Schema::Option(_) => true,
|
||||
_ => false,
|
||||
};
|
||||
if is_option {
|
||||
self.properties.insert(name, schema);
|
||||
} else {
|
||||
self.properties.insert(name, Arc::new(Schema::Option(schema)));
|
||||
}
|
||||
|
||||
self.properties.insert(name, Arc::new(Schema::Option(schema.into())));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user