- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 446
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
Tight loop due to circular reference between two yaml files #132
Comments
I'd look into
Maybe |
I get the latest (not released) code, with the adding of visitedFiles, the tight loop is gone. I think make the swaggerLoader.visited with absolute JSON path is good so we can lower the granularity of circular detection to object level. But we still need to keep the the swaggerLoader.visitedFiles to prevent re-load the same yaml file. |
See if #207 (v0.6.0) solves your second issue. |
Currently, if there are two yaml files, say petstore1.yaml and petstore2.yaml.
In petstore1.yaml, we defined schema Cat. In petstore2.yaml, we defined schema Dog.
But in petstore1.yaml, we have external reference to Dog which defined in petstore2.yaml, and in petstore2.yaml, we have external reference to Cat which defined in petstore1.yaml.
When we load the petstore1.yaml, the openapi3.loader(), it enters tight loop between:
https://github.com/getkin/kin-openapi/blob/master/openapi3/swagger_loader.go#L190
and https://github.com/getkin/kin-openapi/blob/master/openapi3/swagger_loader.go#L519
Due to that, we can not add circular detection in up layer because the initial loading of yaml does not return.
Any suggestion for fixing or workaround this?
The text was updated successfully, but these errors were encountered: