Skip to content

Commit

Permalink
add OAS 3.1 null case
Browse files Browse the repository at this point in the history
  • Loading branch information
tfranzel committed Dec 22, 2023
1 parent 89233e3 commit d78a21c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drf_spectacular/plumbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@ def append_meta(schema: _SchemaType, meta: _SchemaType) -> _SchemaType:
schema['type'] = [schema['type'], 'null']
elif '$ref' in schema:
schema = {'oneOf': [schema, {'type': 'null'}]}
elif len(schema) == 1 and 'oneOf' in schema:
schema['oneOf'].append({'type': 'null'})
else:
assert False, 'Invalid nullable case' # pragma: no cover

Expand Down

0 comments on commit d78a21c

Please sign in to comment.