Using the schema below, if I try to view /swagger.json, I get a RuntimeError from excessive recursion. This does not occur in 2.2.3. Last few lines of the stack trace:
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 113, in resolve_refs
return resolve_ref(spec, subval)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 104, in resolve_ref
return resolve_refs(spec, spec_dict)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 115, in resolve_refs
new_dict[key] = resolve_refs(spec, subval)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 115, in resolve_refs
new_dict[key] = resolve_refs(spec, subval)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 115, in resolve_refs
new_dict[key] = resolve_refs(spec, subval)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 113, in resolve_refs
return resolve_ref(spec, subval)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 104, in resolve_ref
return resolve_refs(spec, spec_dict)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 115, in resolve_refs
new_dict[key] = resolve_refs(spec, subval)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 115, in resolve_refs
new_dict[key] = resolve_refs(spec, subval)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 115, in resolve_refs
new_dict[key] = resolve_refs(spec, subval)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 113, in resolve_refs
return resolve_ref(spec, subval)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/pyramid_swagger/api.py", line 101, in resolve_ref
with spec.resolver.resolving(url):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/jsonschema/validators.py", line 327, in resolving
url, resolved = self.resolve(ref)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/jsonschema/validators.py", line 335, in resolve
url = self._urljoin_cache(self.resolution_scope, ref)
File "/Users/bwarfield/.virtualenvs/popeye/lib/python2.7/site-packages/functools32/functools32.py", line 394, in wrapper
result = cache[key]
RuntimeError: maximum recursion depth exceeded in cmp
Repro case schema:
{
"swagger": "2.0",
"info": {
"title": "Bug demo",
"description": "Recursive object definitions cause problems",
"version": "0.1.0"
},
"definitions": {
"widget": {
"description": "A widget which may have multiple generations of child widgets",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 50
},
"children": {
"type": "array",
"items": {
"$ref":"#/definitions/widget"
}
}
}
}
},
"paths": {
"/resources/widget/{code}" : {
"parameters" : [
{
"name": "code",
"description": "The CODE value for a widget",
"in": "path",
"type": "string",
"required": true
}
],
"get": {
"summary": "View a single widget",
"produces": ["application/json"],
"parameters": [],
"responses": {
"200": {
"description":"Widget local content (without parents or descendents)",
"schema": {"$ref":"#/definitions/widget"}
},
"404": {"description": "The widget does not exist"}
}
}
}
}
}
bug