Discriminators not working for oneOf when the members are allOf schemas
See original GitHub issueGreat tool! Thanks for all the effort.
While generating an API I found out discriminators aren’t working for oneOf
schemas that consist of a list of schemas that themselves are composed with allOf
.
It’s not easy to explain with a few words. I create a repository that reproduces the issue and explained in more detail in the readme there, comparing a working example and the case that fails.
https://github.com/gillchristian/openapi-typescript-codegen-discriminator-report
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:8
Top Results From Across the Web
How to use the OpenAPI discriminator - Redocly
Use anyOf when the item might be valid against more than one of the schemas. Use oneOf when it can only be valid...
Read more >OpenAPI Discrimintors - SmartBear Community
I have been trying to figure out how to handle a situation where a query string parameter changes the response object. Here's my...
Read more >RFC 8927: JSON Type Definition
A "discriminator" form of JSON objects, corresponding to a discriminated (or ... is not a correct JTD schema, as there is no member...
Read more >draft-json-schema-language-00 - IETF Datatracker
If a schema has a "discriminator" member, all of the values of "mapping" ... the following JSON document is not a valid schema...
Read more >Discriminator does not seem to be evaluated - Bitbucket
My first try: Use allOf for Inheritance, apply a discriminator in the super-type and use oneOf in the references, where this supertype is ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We also encountered this issue. The workarounds don’t scale that well. You need a lot of extra code that can also introduce errors. It would be really nice if the generation would respect the discriminators.
If this is implemented, it will be the only typescript client generator that works for my use case.