mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-30 18:09:59 +03:00
Use copy() of properties dict when filtering read/write-only fields.
This commit is contained in:
parent
c0a31ed0a3
commit
de218daa28
|
@ -715,7 +715,7 @@ class OpenAPIAutoSchema(ViewInspector):
|
|||
if method == 'PATCH':
|
||||
del content['required']
|
||||
# No read_only fields for request.
|
||||
for name, schema in content['properties'].items():
|
||||
for name, schema in content['properties'].copy().items():
|
||||
if 'readOnly' in schema:
|
||||
del content['properties']['name']
|
||||
|
||||
|
@ -740,7 +740,7 @@ class OpenAPIAutoSchema(ViewInspector):
|
|||
if isinstance(serializer, serializers.Serializer):
|
||||
content = self._map_serializer(serializer)
|
||||
# No write_only fields for response.
|
||||
for name, schema in content['properties'].items():
|
||||
for name, schema in content['properties'].copy().items():
|
||||
if 'writeOnly' in schema:
|
||||
del content['properties']['name']
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user