Never add a field with the default
attribute to a schema's required
properties
This commit is contained in:
parent
d3b6ff5aeb
commit
22e89a5dd6
1 changed files with 1 additions and 1 deletions
|
@ -129,7 +129,7 @@ pub fn insert_object_property<T: ?Sized + JsonSchema>(
|
|||
properties.insert(key.to_owned(), sub_schema.into());
|
||||
}
|
||||
|
||||
if required || !(has_default || T::_schemars_private_is_option()) {
|
||||
if !has_default && (required || !T::_schemars_private_is_option()) {
|
||||
if let Some(req) = obj
|
||||
.entry("required")
|
||||
.or_insert(Value::Array(Vec::new()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue