Skip to content
Snippets Groups Projects
Commit 41b1d3c9 authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Remove nested serializers fix in OpenAPI patch script

parent f6e36565
No related branches found
No related tags found
No related merge requests found
......@@ -38,27 +38,6 @@ def get_args():
return args
def fix_nested_properties(schema):
"""
Walk through the schema recursively, looking for Schema Objects with type=object,
to change {"properties": {"properties": {}, "required": []}
into {"properties": {}, "required": []}
See https://github.com/encode/django-rest-framework/pull/6568
"""
if schema.get('type') == 'object' \
and 'properties' in schema \
and 'properties' in schema['properties'] \
and 'required' in schema['properties']:
schema = fix_nested_properties(schema['properties'])
schema['type'] = 'object'
return schema
return {
k: (fix_nested_properties(v) if isinstance(v, dict) else v)
for k, v in schema.items()
}
def update_schema(schema, patches):
"""
Perform updates on an OpenAPI schema using another YAML file describing patches.
......@@ -123,7 +102,7 @@ def update_schema(schema, patches):
print('Adding x-name to {} on {}'.format(method, path), file=sys.stderr)
operation['requestBody']['x-name'] = 'body'
return fix_nested_properties(schema)
return schema
def print_endpoints(schema):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment