Skip to content

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

Open
@fredbi

Description

@fredbi

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions