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'):
|
for key in ('properties', 'additionalProperties', 'patternProperties'):
|
||||||
if p.get(key):
|
if p.get(key):
|
||||||
result.setdefault(key, {}).update(p[key])
|
result.setdefault(key, OrderedDict()).update(p[key])
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -368,11 +368,12 @@ def get_tables_for_response(api, schema):
|
||||||
|
|
||||||
def get_example_for_schema(schema):
|
def get_example_for_schema(schema):
|
||||||
"""Returns a python object representing a suitable example for this object"""
|
"""Returns a python object representing a suitable example for this object"""
|
||||||
|
schema = inherit_parents(schema)
|
||||||
if 'example' in schema:
|
if 'example' in schema:
|
||||||
example = schema['example']
|
example = schema['example']
|
||||||
return example
|
return example
|
||||||
if 'properties' in schema:
|
if 'properties' in schema:
|
||||||
res = {}
|
res = OrderedDict()
|
||||||
for prop_name, prop in schema['properties'].iteritems():
|
for prop_name, prop in schema['properties'].iteritems():
|
||||||
logger.debug("Parsing property %r" % prop_name)
|
logger.debug("Parsing property %r" % prop_name)
|
||||||
prop_example = get_example_for_schema(prop)
|
prop_example = get_example_for_schema(prop)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue