schema: AllOf/OneOf: actually perform additional_properties() check

rather than just always allowing additional properties, only return
true if any of the available schemas allows it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2024-02-21 11:41:53 +01:00
parent 3f92e6286b
commit bae2cf75de

View File

@ -917,7 +917,12 @@ impl ObjectSchemaType for AllOfSchema {
} }
fn additional_properties(&self) -> bool { fn additional_properties(&self) -> bool {
true self.list.iter().any(|schema| {
schema
.any_object()
.expect("non-object-schema in `AllOfSchema`")
.additional_properties()
})
} }
fn default_key(&self) -> Option<&'static str> { fn default_key(&self) -> Option<&'static str> {
@ -988,7 +993,12 @@ impl ObjectSchemaType for OneOfSchema {
} }
fn additional_properties(&self) -> bool { fn additional_properties(&self) -> bool {
true self.list.iter().any(|(_, schema)| {
schema
.any_object()
.expect("non-object-schema in `OneOfSchema`")
.additional_properties()
})
} }
fn default_key(&self) -> Option<&'static str> { fn default_key(&self) -> Option<&'static str> {