Hi,
in Version 3.10.3 the OpenAPI Schema removes required from the request body if the action is Patch:
if method == 'PATCH': del content['required']
but required is only set if there is actually a required field (_map_serializer):
if len(required) > 0: result['required'] = required
which leads to an obvious:
| Request Method: |
GET |
| http://127.0.0.1:8000/api/schema/ |
|
| 2.2.5 |
|
| KeyError |
|
| 'required' |
|
| /Users/sven/Programmieren/IT/repos/pegasus/pegasus/vtair/venv/lib/python3.7/site-packages/rest_framework/schemas/openapi.py in _get_request_body, line 466 |
|
| /Users/sven/Programmieren/IT/repos/pegasus/pegasus/vtair/venv/bin/python3 |
|
| 3.7.3 |
|
| ['/Users/sven/Programmieren/IT/repos/pegasus/pegasus/vtair', '/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Users/sven/Programmieren/IT/repos/pegasus/pegasus/vtair/venv/lib/python3.7/site-packages'] |
|
There should be a check for if 'required' in content
Best
Sven
Hi,
in Version 3.10.3 the OpenAPI Schema removes required from the request body if the action is Patch:
if method == 'PATCH': del content['required']but required is only set if there is actually a required field (_map_serializer):
if len(required) > 0: result['required'] = requiredwhich leads to an obvious:
There should be a check for if 'required' in content
Best
Sven