You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have found an error in the resolver in latest versions 10.0.x of swagger-parser (it was working fine in versions 9.0.x). The error occurs while de-referencing circular references in APIs with external references across different files.
Let me include an example of cross-referenced APIs, to reproduce the error:
If you try to validate the main API with swagger-parser 10.0.x, using e.g.:
SwaggerParser.validate('./openapi.yaml');
you get the error:
Token "A1" does not exist.
In earlier versions (9.x.0) it worked fine (as it should, since A1 is obviously resolvable).
For what is worth, and if it helps to troubleshoot the issue, I noted that in the main file openapi.yaml, the order of the items in the anyOf construct, seems to matter. So, if you have:
Hi again,
The example above is a narrowed-down excerpt, that comes form a real-life API, but I guess it looks like a non-realistic and convoluted example, having such artificial data type names, and weird type relationships... :)
Let me add another example, even simpler, and with quite realistic data type names and references, so I hope it makes it quite apparent that the failure can indeed occur VERY frequently:
Hi,
I have found an error in the resolver in latest versions 10.0.x of swagger-parser (it was working fine in versions 9.0.x). The error occurs while de-referencing circular references in APIs with external references across different files.
Let me include an example of cross-referenced APIs, to reproduce the error:
Main file
openapi.yaml
:File
A.yaml
:If you try to validate the main API with swagger-parser 10.0.x, using e.g.:
SwaggerParser.validate('./openapi.yaml');
you get the error:
Token "A1" does not exist.
In earlier versions (9.x.0) it worked fine (as it should, since A1 is obviously resolvable).
For what is worth, and if it helps to troubleshoot the issue, I noted that in the main file
openapi.yaml
, the order of the items in theanyOf
construct, seems to matter. So, if you have:it fails the resolution. While, if you have:
it works fine (in versions 10.x.0 too!)
The text was updated successfully, but these errors were encountered: