swagger-typescript-api: "circularly references itself" errors after upgrade to 13
Command: swagger-typescript-api --extract-enums --no-client --path https://raw.githubusercontent.com/europace/baufismart-kundenangaben-api/master/kundenangaben-openapi.yaml --name kundenangaben-api.model.ts
Worked with 12, but now typescript throws “circularly references itself” errors with 13.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 12
- Comments: 17
Commits related to this issue
- fix: circular type definition why: https://github.com/acacode/swagger-typescript-api/issues/564 — committed to TinxHQ/wazo-ts-types by Romej a year ago
I fixed this by modifying https://github.com/acacode/swagger-typescript-api/blob/master/src/code-gen-process.js#L122-L124
to be
This forces the schemas that have a
discriminatorto execute first creating the right types.Looks like this is not works properly. This fix produces code like this (from “oneOf” + “ref”):
Which is literally useless (works same as just “any”).
Let’s simplify initial example:
I assume that instead of
lib should generate next lines and use
BaseConfiginstead ofConfigSame here. Upgrading from 12 to 13 introduced circular references similar to below.
The previous output:
The new, circular dependency style: