Closed sisp closed 5 years ago
I think this is already supported. Here is the test case:
def test_unmarshal_nullable_array_items():
schema = {
'type': 'array',
'items': {
'nullable': True,
'type': 'string',
'format': 'date',
},
}
instance = [None, '2018-01-02']
unmarshaled = SchemaUnmarshaler().unmarshal(instance, schema)
assert unmarshaled == [None, datetime.date(2018, 1, 2)]
It seems you're right. Sorry.
I had a case with a nullable enum and nullable array items for which the entire schema failed (because multiple sub-schemas are combined with anyOf
) and I somehow concluded that support for both nullable cases was missing. But it's working only with added nullable enum support.
I believe OpenAPI supports
nullable
also for array items.falcon-oas
currently does not honornullable
inside array items:To support this, another custom validator for
items
needs to be added like this one: https://github.com/grktsh/falcon-oas/blob/0328d7f4c0c806bc2cdd9c45f5c720a1ec61cbc4/src/falcon_oas/oas/schema/validators.py#L11-L19I'd be happy to create a PR if you agree that array items can be nullable according to OpenAPI 3.