-
-
Notifications
You must be signed in to change notification settings - Fork 531
Circular reference when using inheritance & polymorhism with discriminator #1565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I found one more problem. When changing this:
generator omits discriminator property "petType" and changes petType
|
I think this is correct, and your code is circular. Since Most discriminator code I’ve seen don’t use both together; it should probably be one or the other. Further they mean different things; Lastly, using |
Thanks for clarifying all the details. You are right that some parts of the example can cause problems. I updated the example based on your comments and all looks good, except the case when a discriminator is added. With this schema:
I'm still getting invalid polymorphic "pet" property.
In both versions v6 & v7 Discriminator property "petType" is omitted, and additionally in v6 replaced with strange value of "PetOwner". Do you know if I'm still messing with the schema structure? |
@mzronek |
@clxandstuff Have you tested it with the latest v7 version? Can we close this? |
Hi @mzronek I'm gonna test it today and let you know |
This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed. |
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem. |
Description
Not sure if this is a bug. I would like to confirm that types generation is possible with my schema
openapi-typescript
7.0.0
&6.7.4
18.18.1
macOS 13, Windows 11, etc.
Reproduction
Generate types with below schema.
It results in:
Expected result
I expect Cat & Dog to not reference Pet
so I can use types like this
Is this possible with the current version? If not I can try to fix this, if you guide me where to start.
Checklist
npx @redocly/cli@latest lint
) - there are some unrelated license and security errorsThe text was updated successfully, but these errors were encountered: