From c2b29240d96e77e819e9a67f18b8d1d87a4e82c7 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 8 Dec 2015 16:45:41 +0100 Subject: [PATCH] guess type if not given --- bravado_core/spec.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bravado_core/spec.py b/bravado_core/spec.py index e5cdc221..27a6e67c 100644 --- a/bravado_core/spec.py +++ b/bravado_core/spec.py @@ -335,6 +335,11 @@ def descend(fragment, path, visited_refs): # fragment is guaranteed not to be a ref from this point onwards if is_dict_like(fragment): + if 'type' not in fragment: + if 'properties' in fragment: + fragment['type'] = 'object' + elif 'items' in fragment: + fragment['type'] = 'array' for key, value in iteritems(fragment): fire_callbacks(fragment, key, path + [key]) descend(fragment[key], path + [key], visited_refs)