Skip to content
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

earlier circular reference detection #766

Closed
maciej opened this issue Feb 12, 2023 · 3 comments
Closed

earlier circular reference detection #766

maciej opened this issue Feb 12, 2023 · 3 comments

Comments

@maciej
Copy link

maciej commented Feb 12, 2023

Given a circular reference between two components I'd expect it to be detected when a first cycle appears in the reference traversal stack, so in the example linked here:

https://go.dev/play/p/0QT2aV29OSF

I'd expect to see:

circular schema reference not handled - #/components/schemas/loop-endless -> #/components/schemas/endless-loop -> #/components/schemas/loop-endless

without the additional cycle mentioned in the error message.

@radwaretaltr
Copy link
Contributor

Hi, you can modify the CircularReferenceCounter and set it to 2.
https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3#:~:text=var%20CircularReferenceCounter%20%3D%203

@radwaretaltr
Copy link
Contributor

Hi, you can modify the CircularReferenceCounter and set it to 2. https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3#:~:text=var%20CircularReferenceCounter%20%3D%203

I wouldn't recommend it though. The "CircularReferenceCounter" name is a bit misleading. It actually counts how many time the loader visited a schema reference. There are valid cases in which you will need to actually raise the value of "CircularReferenceCounter" in order to load the schema successfully.

@AnatolyRugalev
Copy link
Contributor

CircularReferenceCounter and the mentioned error message has been removed in #970, so the issue doesn't seem to be relevant anymore

@fenollp fenollp closed this as completed Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants