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

[feature request] Add support for oneOf by leveraging Dart 3.0 features #94

Open
T-moz opened this issue Jun 3, 2023 · 1 comment
Open

Comments

@T-moz
Copy link

T-moz commented Jun 3, 2023

Describe the current situation
As of today oneOf is supported by using optional parameters

Expected behavior
OneOf could be handled by the new dart 3.0 patterns or sealed class ?

Versions
7.2

Additional context
Patterns
Sealed class

@rvowles
Copy link
Member

rvowles commented Jun 4, 2023

I'm not sure how it would do that? The issue in Dart is not deserialising into the different known types, a code generator can do that fairly easily, it is more than a function cannot return more than one distinct type - so we couldn't have a function return Fish | CarBrake | Number | Boolean - it would simply have to return an object.

oneOf is used to support all different types of situations, could you give some YAML and indicate how these 3.0 concepts would be surfaced? Any useful ideas I am happy to fold in!

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

No branches or pull requests

2 participants