oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

Nested type declaration in separate file causes specs to fail to load

Open ydarma opened this issue 2 years ago • 2 comments

Hello,

If the yaml spec is splitted in 2 files as follows:

  • api.yaml: paths that refers to models.yaml#components/schemas/XXX
  • models.yaml: components that re sub component #components/schemas/YYY

At startup the GetSwagger() function returns an error that complains that #components/schemas/YYY is not found.

You'll find an example to reproduce this behavior here: https://github.com/ydarma/oapi-codegen-subtype

Thancks

ydarma avatar Jan 19 '23 14:01 ydarma

Do you have this problem all the time or does it regenerating the sources a few times makes it work?

luminoso avatar Oct 07 '24 08:10 luminoso

Hello, I remember that the problem always happened. It is an old thread, I remember that we decided to work this around and to not use a separate model specification. Recently on another project we went with a separate model file with nested components and now it works. Maybe the problem has been fixed since.

ydarma avatar Oct 08 '24 15:10 ydarma