-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
If a property is defined via a $ref and it's nullable set to True, then this nullable will be ignored.
If you take an example from the TODO app, make a title nullable:
Item:
type: object
required:
- title
properties:
title:
type: string
maxLength: 40
nullable: true
and modify ITEMS in app.py to contain an item with null property:
ITEMS = [
Item(title="Buy milk"),
Item(title="Buy eggs"),
Item(title="Make pankaces!"),
Item(title=None),
]Then everything works fine.
However, if we define title via a $ref:
Title:
type: string
maxLength: 40
nullable: true
Item:
type: object
required:
- title
properties:
title:
$ref: '#/components/schemas/Title'
Then we get the following error:
Value [{'title': 'Buy milk'}, {'title': 'Buy eggs'}, {'title': 'Make pankaces!'}, {'title': None}] not valid for schema of type SchemaType.ARRAY: (<ValidationError: 'None for not nullable'>,)
Note that we started observing this error only since yesterday, before it was working as expected.
Metadata
Metadata
Assignees
Labels
No labels