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

Expander: the expanded spec is unusable to resolve circular $ref #180

Open
fredbi opened this issue Dec 23, 2023 · 0 comments
Open

Expander: the expanded spec is unusable to resolve circular $ref #180

fredbi opened this issue Dec 23, 2023 · 0 comments

Comments

@fredbi
Copy link
Member

fredbi commented Dec 23, 2023

This is a nasty bug: so far I've failed to nail it.

When expanding schemas in a spec for further use (e.g. validating the spec, flattening it with the expand option),
circular $ref are left in a unusable state in the $ref cache, leading to jsonpointer errors (e.g. "xxx has no key yyy")
when attempting to resolve.

This is for example the root cause for go-swagger/go-swagger#2346.
In go-swagger, it is possible to work around this issue by reloading the spec as a fresh go-openapi/loads.Document,
but this is not ideal.
This workaround is used on 2 occasions in go-swagger:

@fredbi fredbi changed the title Expand: the expanded spec is unusable to resolve circular $ref Expander: the expanded spec is unusable to resolve circular $ref Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant