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

Most upvoted comments

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:

components:
  schemas:
    MyTypeName:
      $ref: "./components/schemas/MyTypeName.yaml"

This is just one case, there might be other conditions triggering the same problem. Tested on v1.12.4.