Add a check for 'required' before deletion

This commit is contained in:
haiyangdeperci 2019-09-09 11:34:48 +02:00 committed by GitHub
parent 89ac0a1c7e
commit 30c91a6aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -462,7 +462,7 @@ class AutoSchema(ViewInspector):
content = self._map_serializer(serializer)
# No required fields for PATCH
if method == 'PATCH':
if method == 'PATCH' and content.get('required'):
del content['required']
# No read_only fields for request.
for name, schema in content['properties'].copy().items():