Description
I think requiring property names listed in required
to be defined in properties
is too strict. I also couldn't find this requirement in the JSON Schema or OpenAPI specs. JSON Schema validators and the Swagger Editor are fine with property names listed in required
that are not defined in properties
.
It makes sense to list required properties without defining them in properties
when using allOf
where one sub-schema requires some properties but does not specify them while another sub-schema only provides the specifications of the properties (possibly even without stating which ones are required and which ones aren't). This is especially useful when referencing and merging schema definitions or when expressing discriminated unions with some properties that are common to all union members.
I suggest to remove the following code block
and the require_properties
argument:
I have seen the test case
but it also seems to be valid to express this schema like this:
{
'Credit': {
'type': 'object',
'properties': {
'clientId': {'type': 'string'},
}
},
'CreditCreate': {
'type': 'object',
'required': ['clientId'],
'allOf': [
{
'$ref': '#/components/schemas/Credit'
},
# possibly more schemas to merge ...
]
}
}
Or did I miss this rule somewhere in the spec?