Open wjo1212 opened 8 years ago
You can fix this issue using:
import json
print(json.dumps(Directory.get_schema(ordered=True), indent=4))
I don't believe we need to change the get_schema
implementation, maybe just change the documentation to show how to output the schema the way it is presented.
Cheers ;)
run the sample in the guide result:
OrderedDict([('$schema', 'http://json-schema.org/draft-04/schema#'), ('definitions', OrderedDict([('__main__.Directory', OrderedDict([('type', 'object'), ('properties', OrderedDict([('name', OrderedDict([('type', 'string')])), ('content', OrderedDict([('type', 'array'), ('items', OrderedDict([('oneOf', [{'$ref': '#/definitions/__main__.File'}, {'$ref': '#/definitions/__main__.Directory'}])]))]))])), ('required', ['name', 'content']), ('additionalProperties', False)])), ('__main__.File', OrderedDict([('type', 'object'), ('properties', OrderedDict([('name', OrderedDict([('type', 'string')])), ('content', OrderedDict([('type', 'string')]))])), ('required', ['name', 'content']), ('additionalProperties', False)]))])), ('$ref', '#/definitions/__main__.Directory')])