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':
|
if method == 'PATCH':
|
||||||
del content['required']
|
del content['required']
|
||||||
# No read_only fields for request.
|
# 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:
|
if 'readOnly' in schema:
|
||||||
del content['properties']['name']
|
del content['properties']['name']
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ class OpenAPIAutoSchema(ViewInspector):
|
||||||
if isinstance(serializer, serializers.Serializer):
|
if isinstance(serializer, serializers.Serializer):
|
||||||
content = self._map_serializer(serializer)
|
content = self._map_serializer(serializer)
|
||||||
# No write_only fields for response.
|
# 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:
|
if 'writeOnly' in schema:
|
||||||
del content['properties']['name']
|
del content['properties']['name']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user