oapi-codegen: unexpected reference depth
Hi guys,
I am getting the following error
error generating code: error creating operation definitions: error generating response definitions: error turning reference (#/paths/~1me~1/put/responses/400) into a Go type: unexpected reference depth: 6 for ref: #/paths/~1me~1/put/responses/400 local: true
I see that there is a validation in the source code against strictly defined depth, but is there a specific reason for that?
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 8
- Comments: 16 (5 by maintainers)
Commits related to this issue
- Reject parsing non-compliant OpenAPI specs This kinda fixes #867 by rejecting specs that we know we can't parse. We only support 3.0.x openAPI specs, which must have the `openapi` property as semver... — committed to oapi-codegen/oapi-codegen by deleted user 2 years ago
- Fix #867 by intercepting spec loading This change adds a shim into the Kin loader which attempts to find an `openapi` or `swagger` version key in the spec, and returns an error if it's an unsupported... — committed to oapi-codegen/oapi-codegen by deleted user 2 years ago
Hello, I’m also a bit curious to why this depth-restriction exists. I would appreciate some insights!
Best Regards,
This happens when using notation
$ref: "./components/schemas/MyTypeName.yaml"in more than one place, but where the root yaml file is missing an (seemingly reduntant, yet crucial) entry:This is just one case, there might be other conditions triggering the same problem. Tested on v1.12.4.