[Bug] Circularly references when using discriminator
Describe the bug
When using discliminator, cyclic dependencies appear in types. The problem appeared in version 13.0.0, where support was added.
[email protected]
There was no discriminator support in this version, so the problem does not occur.
[email protected]
This version added support for discriminator, but it does not work correctly. This causes circular type references.
[email protected]
This library supports discriminator and there are no problems with cyclic type references.
Reproduction
Open StackBlitz:
[email protected]- generated/Api12.ts[email protected]- generated/Api13.ts[email protected]- generated/Api.ts
Facing same issue with 13.0.0
I was facing a similar issue, and narrowed it down to the order of the schemas in the API spec.
The parent schema has to appear BEFORE the schema that references it (with $ref). If the parent appears after, the generated types don't use the "Base" type, and instead inserts the circular reference.
This is what's preventing me from migrating to v13 now that #564 and #1417 have been resolved.
Maybe @smorimoto can help us 🤞.
Thanks in advance!