Updates to swagger table generation

A bunch of related fixes to the code for parsing the state and API yaml files:

1. Some of our objects are {key: {key: value}} - style nested key/value
   dictionaries. Handle this by refactoring get_json_schema_object_fields so
   that such objects are handled wherever they appear, rather than when they
   are just subproperties of a 'proper' object.

2. Fix multi-level inheritance (so an object can have an 'allOf' property which
   can successfully refer to an object which itself has an 'allOf' property).

3. $ref fields in event schemas weren't being expanded correctly

4. sort type tables breadth-first rather than depth-first so that the ordering
   in complex structures like the /sync response makes a bit more sense.
This commit is contained in:
Richard van der Hoff 2015-11-15 17:21:56 +00:00
parent ea364a108b
commit 838af2a23e
2 changed files with 128 additions and 72 deletions

View file

@ -42,6 +42,7 @@ from jinja2 import Environment, FileSystemLoader, StrictUndefined, Template, met
from argparse import ArgumentParser, FileType
import importlib
import json
import logging
import os
import sys
from textwrap import TextWrapper
@ -188,6 +189,9 @@ if __name__ == '__main__':
)
args = parser.parse_args()
if args.verbose:
logging.basicConfig(level=logging.DEBUG)
if not args.input:
raise Exception("Missing [i]nput python module.")