regrandfather json-formatted example params
This commit is contained in:
parent
af84ca09a0
commit
b12b38d680
1 changed files with 12 additions and 1 deletions
|
@ -390,7 +390,18 @@ def get_example_for_param(param):
|
|||
schema = param.get('schema')
|
||||
if not schema:
|
||||
return None
|
||||
return json.dumps(get_example_for_schema(schema), indent=2)
|
||||
|
||||
# allow examples for the top-level object to be in formatted json
|
||||
exampleobj = None
|
||||
if 'example' in schema:
|
||||
exampleobj = schema['example']
|
||||
if isinstance(exampleobj, basestring):
|
||||
return exampleobj
|
||||
|
||||
if exampleobj is None:
|
||||
exampleobj = get_example_for_schema(schema)
|
||||
|
||||
return json.dumps(exampleobj, indent=2)
|
||||
|
||||
def get_example_for_response(response):
|
||||
"""Returns a stringified example for a response"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue