diff --git a/src/api/schema.rs b/src/api/schema.rs index 9917e574..2cb6c90a 100644 --- a/src/api/schema.rs +++ b/src/api/schema.rs @@ -281,17 +281,7 @@ impl ObjectSchema { } pub fn optional>>(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 } }