-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenAPI v3.1 causes stack overflow #51
Comments
Huh. That schema is a real head scratcher. It has a root level reference, which points to somewhere within itself. I'm tempted to say that's not even a valid json reference. |
To elaborate on what I mean, here is a stripped down subset of the schema: {
"$ref": "#/$defs/specification-extensions",
"type": "object",
"$defs": {
"specification-extensions": {
"patternProperties": {"^x-": true}
}
}
} Since this is an object with a $ref property, this whole object is considered a reference object. And it references something inside of iteself. Since this library allows reference uri fragments to point inside of other references in the doc, it tries to resolve the base level reference before doing the json pointer lookup. Since it resolves to itself, this is why we are getting the recursion error. Also #40 The other issue is that OpenAPI is clearly relying on the merging of extra properties from the reference object in with referent data. Since the json reference spec says that implementations may replace a json reference object with the value it refers to, this whole thing would evaluate to just: {
"patternProperties": {"^x-": true}
} (assuming the self referent reference objects are even allowed) All that being said, I think I figured out a way to make things work. I really wish someone would update the JSON reference spec though, since as is both of these seem outside the current writing, but many libraries/schemas are still using it in the wild. |
Hi,
I've been trying to get jsonref to work with the OpenAPI v3.1 spec and always hit an error when the lazy-loaded refs are expanded. OpenAPI v3.0 works fine, so I guess the cause is down to the introduction of a
$defs
section. Here's an example program:Running this on my system with Python 3.10 results in this error (with a very long stack trace):
Do you have any suggestions for a work-around? Thanks in advance.
The text was updated successfully, but these errors were encountered: