Merge pull request #408 from matrix-org/rav/more_ordering_fixes
More ordering fixes
This commit is contained in:
commit
0f5e924ac9
1 changed files with 3 additions and 2 deletions
|
@ -106,7 +106,7 @@ def inherit_parents(obj):
|
|||
|
||||
for key in ('properties', 'additionalProperties', 'patternProperties'):
|
||||
if p.get(key):
|
||||
result.setdefault(key, {}).update(p[key])
|
||||
result.setdefault(key, OrderedDict()).update(p[key])
|
||||
|
||||
return result
|
||||
|
||||
|
@ -368,11 +368,12 @@ def get_tables_for_response(api, schema):
|
|||
|
||||
def get_example_for_schema(schema):
|
||||
"""Returns a python object representing a suitable example for this object"""
|
||||
schema = inherit_parents(schema)
|
||||
if 'example' in schema:
|
||||
example = schema['example']
|
||||
return example
|
||||
if 'properties' in schema:
|
||||
res = {}
|
||||
res = OrderedDict()
|
||||
for prop_name, prop in schema['properties'].iteritems():
|
||||
logger.debug("Parsing property %r" % prop_name)
|
||||
prop_example = get_example_for_schema(prop)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue