Skip to content

Commit

Permalink
Merge pull request #688 from krectra/master
Browse files Browse the repository at this point in the history
Add checker for allow_null attr
  • Loading branch information
JoelLefkowitz authored Jul 18, 2022
2 parents 13f0af2 + fe08c76 commit cb03608
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/drf_yasg/inspectors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ def SwaggerType(existing_object=None, use_field_title=True, **instance_kwargs):
instance_kwargs.setdefault('title', title)
if description is not None:
instance_kwargs.setdefault('description', description)
if field.allow_null:

if getattr(field, 'allow_null', None):
instance_kwargs['x_nullable'] = True

instance_kwargs.update(kwargs)
Expand Down

0 comments on commit cb03608

Please sign in to comment.