question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discriminators not working for oneOf when the members are allOf schemas

See original GitHub issue

Great 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:open
  • Created 2 years ago
  • Reactions:9
  • Comments:8

github_iconTop GitHub Comments

4reactions
Xyarencommented, Jun 29, 2022

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.

1reaction
benlongocommented, Oct 9, 2022

If this is implemented, it will be the only typescript client generator that works for my use case.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found