dart-ogurets / dart-openapi-maven

A Maven dependency for use with the OpenAPI swagger Maven plugin
BSD 2-Clause "Simplified" License
27 stars 11 forks source link

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

Open T-moz opened 1 year ago

T-moz commented 1 year ago

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 commented 1 year ago

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!