lib/swagger/schema.rb in swagger-parser-0.2.5 vs lib/swagger/schema.rb in swagger-parser-0.2.6
- old
+ new
@@ -15,16 +15,17 @@
def parse
schema = clone
if schema.key?('$ref')
key = schema.delete('$ref').split('/').last
- model = root.definitions[key]
+ model = root.definitions[key].parse
schema.merge!(model)
end
count = 0
until schema.refs_resolved?
+ #puts count
fail 'Could not resolve non-remote $refs 5 cycles - circular references?' if count >= 5
schema.resolve_refs
count += 1
end
@@ -42,10 +43,10 @@
child.resolve_refs if child.is_a?(Swagger::Schema)
end
key = self.delete('$ref')
return if key.nil? || remote_ref?(key)
key = key.split('/').last
- model = root.definitions[key]
+ model = root.definitions[key].parse
self.merge!(model)
end
def refs_resolved?
return true if refs.nil?