Skip to content

Commit

Permalink
fix(types): fix incorrect nested type names
Browse files Browse the repository at this point in the history
There was a name-duplication which led to un-inmplemented types.

The good thing is that this was the last issue that kept all 72
APIs from compiling.
  • Loading branch information
Byron committed Mar 11, 2015
1 parent 7e24393 commit 4f794ef
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/mako/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ def canonical_type_name(s):
return capitalize(s)

def nested_type_name(sn, pn):
return sn + canonical_type_name(pn)
suffix = canonical_type_name(pn)
return sn + suffix

# Make properties which are reserved keywords usable
def mangle_ident(n):
Expand Down Expand Up @@ -633,7 +634,7 @@ def recurse_properties(prefix, rs, s, parent_ids):
rs = s
# end this is already a perfectly valid type

properties = s.get('properties', {rs.id: s})
properties = s.get('properties', {'': s})
for pn, p in properties.iteritems():
link_used(p, rs)
if is_nested_type_property(p):
Expand All @@ -645,12 +646,13 @@ def recurse_properties(prefix, rs, s, parent_ids):
if 'items' in p:
ns.update((k, deepcopy(v)) for k, v in p.items.iteritems())

recurse_properties(nested_type_name(prefix, pn), ns, ns, append_unique(parent_ids, rs.id))
recurse_properties(ns.id, ns, ns, append_unique(parent_ids, rs.id))
elif _is_map_prop(p):
recurse_properties(nested_type_name(prefix, pn), rs, p.additionalProperties, append_unique(parent_ids, rs.id))
recurse_properties(nested_type_name(prefix, pn), rs,
p.additionalProperties, append_unique(parent_ids, rs.id))
elif 'items' in p:
# it's an array
recurse_properties(nested_type_name(prefix, pn), rs, p.items, append_unique(parent_ids, rs.id))
recurse_properties(nested_type_name(prefix, pn), rs,
p.items, append_unique(parent_ids, rs.id))
# end handle prop itself
# end for each property
# end utility
Expand Down

0 comments on commit 4f794ef

Please sign in to comment.