Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Stable/0.3.x: Schema object's required field cannot be empty #686

Open
wants to merge 1 commit into
base: stable/0.3.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rest_framework_swagger/docgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def get_models(self, apis):
'required': [i for i in data['required'] if i in w_properties.keys()],
'properties': w_properties,
}
if not models[w_name]['required']:
del models[w_name]['required']

# Reading
# no write_only fields
Expand All @@ -178,6 +180,8 @@ def get_models(self, apis):
'required': [i for i in r_properties.keys()],
'properties': r_properties,
}
if not models[r_name]['required']:
del models[r_name]['required']

# Enable original model for testing purposes
# models[serializer_name] = {
Expand Down