Skip to content
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

re introduce descriminator support for dynamite #1231

Open
Leptopoda opened this issue Dec 5, 2023 · 3 comments
Open

re introduce descriminator support for dynamite #1231

Leptopoda opened this issue Dec 5, 2023 · 3 comments

Comments

@Leptopoda
Copy link
Member

Since #1173 discriminators are no longer supported.
There is no way to support them with records so we will need to generate these ofs the old way.

Another Idea would be to wrap these records in a class that handles the discriminator.

@provokateurin
Copy link
Member

This should be tackled for the next release. If we go with classes from #1508 anyway, it should be easier, right?

@provokateurin
Copy link
Member

Ideally both oneOf and discriminator (which is really just a more strict variant of oneOf) get implemented using common interfaces. For oneOf the interface would not have any members, but for discriminator it should have the property that is used to discriminate and the type of that field would be an enum of all the possible values.
That would make it possible to use exhaustive switch statements with the type but also the property.

Related to #1508

@provokateurin
Copy link
Member

I think oneOf and discriminator need to be handled separately. Only with a discriminator we know that all schemas are objects and have at least one common field. With a plain oneOf we don't as any combination is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants