From 54540e695a9b246ca3d412ab62e843e4dd7974d0 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 11 Mar 2015 11:18:22 +0100 Subject: [PATCH] fix(types): nested types work for arrays Thanks to removed code which made no sense to me, I put in a bug. Now the code is back, beta than ever, and documented as well :). --- src/mako/lib/util.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mako/lib/util.py b/src/mako/lib/util.py index 6dbf9273e0..f39e0ac832 100644 --- a/src/mako/lib/util.py +++ b/src/mako/lib/util.py @@ -340,10 +340,14 @@ def iter_nested_types(schemas): ns.id = nested_type_name(prefix, pn) ns[NESTED_TYPE_MARKER] = True + # To allow us recursing arrays, we simply put items one level up + if 'items' in p: + ns.update((k, deepcopy(v)) for k, v in p.items.iteritems()) + yield ns - - for np in iter_nested_properties(prefix + canonical_type_name(pn), ns.properties): - yield np + if 'properties' in ns: + for np in iter_nested_properties(prefix + canonical_type_name(pn), ns.properties): + yield np elif _is_map_prop(p): # it's a hash, check its type for np in iter_nested_properties(prefix, {pn: p.additionalProperties}):