-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[REQ] Feature Request OAS 3.0 manyOf etc. #15119
Comments
I need to say I would appreciate anyOf. |
@Huholoman Some generators (e.g. C#, Java, Go, Python, etc) already supports anyOf Which one did you try? |
@wing328 Ive tried Dart. It generated weird code and then I have read anyOf is not supported, so I though it generated something just by accident. There are my components "components" : {
"schemas" : {
"com.example.something.Location" : {
"anyOf" : [ {
"$ref" : "#/components/schemas/com.example.something.GeoLocation"
}, {
"$ref" : "#/components/schemas/com.example.something.ServiceLocation"
} ],
"title" : "Location"
},
"com.example.something.GeoLocation" : {
"type" : "object",
"properties" : {
"lat" : {
"type" : "number",
"format" : "double",
"title" : "Double"
},
"lon" : {
"type" : "number",
"format" : "double",
"title" : "Double"
}
},
"required" : [ "lat", "lon" ],
"title" : "GeoLocation"
},
"com.example.something.ServiceLocation" : {
"type" : "object",
"properties" : {
"serviceId" : {
"type" : "string",
"title" : "String"
}
},
"required" : [ "serviceId" ],
"title" : "ServiceLocation"
},
"com.example.something.SomethingWithLocation" : {
"type" : "object",
"properties" : {
"location" : {
"$ref" : "#/components/schemas/com.example.something.Location"
},
"title" : {
"type" : "string",
"title" : "String"
}
},
"required" : [ "location", "title" ],
"title" : "SomethingWithLocation"
}
} I generated the openapi.json using smiley4-swagger-ui. There is missing "type" in the "location" component in the json so far, which ill need on frontend to detect which location actually arrived. But the generated client dart code is still wrong. Dart "Location" is class which has properties from both GeoLocation and ServiceLocation and all props are required. Geo/ServiceLocation are generated with correct props, but component SomethingWithLocation accepts only "Location". I would expect that i can pass GeoLocation or ServiceLocation to SomethingWithLocation as Location. Now I highly doubt current state of anyOf in generated Dart code is correct, but I can be wrong; any help or clarification is welcome. |
I saw this PR related to anyOf support in Dart: #14528 cc @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08) to see if they've more info. |
there are currently 2 flavors of oneof,anyof support one in dart-dio generator that uses a buggy and unreliable implementation one in dart-next #18970 that uses similar representation as protobuf |
This has been on your short term roadmap for quite a while - do you have any updates when you are planning to release this feature?
The text was updated successfully, but these errors were encountered: