From 8643b4aaddb2e522526f065c29bed3f80ea1bc2f Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 19 May 2015 15:36:44 +0100 Subject: [PATCH] Update v1 paths, recursively print JSON format for arrays as well as objects. --- templating/internal/units.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/templating/internal/units.py b/templating/internal/units.py index cdade6836..aff48a2b1 100644 --- a/templating/internal/units.py +++ b/templating/internal/units.py @@ -12,7 +12,7 @@ def prop(obj, path): return val def _load_examples(): - path = "../event-schemas/examples" + path = "../event-schemas/examples/v1" examples = {} for filename in os.listdir(path): if not filename.startswith("m."): @@ -24,7 +24,7 @@ def _load_examples(): return examples def _load_schemas(): - path = "../event-schemas/schema" + path = "../event-schemas/schema/v1" schemata = {} def format_for_obj(obj): @@ -41,6 +41,12 @@ def _load_schemas(): "<%s>" % obj.get("additionalProperties").get("type") ) } + elif obj_type == "" and obj.get("items"): + return [ + format_for_obj(obj.get("items")) + ] + + enum_text = "" # add on enum info enum = obj.get("enum")