ng-openapi-gen: Referencing the same external file multiple times results in error

Hi,

just discovered strange behaviour in ng-openapi-gen. When I split OpenAPI document into multiple files and try to reference one external file (ie. a model schema) using $ref multiple times in a single “main” file, ng-openapi-gen results in error Error on API generation from main-error.yaml: Error: Couldn't resolve reference. Using exactly the same ref file content, but in different files, works correctly.

Can be replicated using this gist: https://gist.github.com/ondrakoupil/aa986212d90f598cf96dbda01cdc1545

Running ng-openapi-gen -i main-error.yaml -o out results in:

Error on API generation from main-error.yaml: Error: Couldn’t resolve reference #/paths/~1hello/get/responses/200/content/application~1json/schema/properties/firstProperty

Running ng-openapi-gen -i main-working.yaml -o out is fine.

The only difference is that in first case, file ref.yaml is referenced three times, but in second case I used separate files ref.yaml, ref2.yaml and ref3.yaml, even though they’re contents is exactly the same.

Using ng-openapi-gen 0.15.0

Thanks.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Any news about this?