OpenApi Should support OpenAPI 3.1 AND thus OneOf for Enums AND Generics. #58239
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
feature-openapi
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
Status: Resolved
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
Right now, enums don't populate at all unless you globally override Json serialization. #58230
But that's just OpenAPI 2.0 support that doesn't solve the real problem of enums in OpenAPI in that they can't represent key/value pairs.
Further, there is no support at all for generics in the current implementation so Result just gets generated as endless duplicate types instead of using the OpenAPI 3.1 spec that allows these to just be Result with optional generic definitions as properties inside the object.
Describe the solution you'd like
By supporting Open API 3.1 across the entire set of libraries for OpenAPI this can be fixed so that C# can generate a full expression of what would create a great cllent: Enums with key/values and Generics that don't repeat themselves. as 2 instances. I'm sure there are other use cases for the Open API 3.1 spec.
This should also be extended with support into Kiota for all of this as well so that it is coordinated across the entire generation cycle from server to client(s).
Additional context
As noted in the referenced ticket it's possible to hack this functionality in, but it should be at the root and just done automatically as it doesn't break existing client generators by adding this support, while it creates much richer and cleaner clients when it is implemented.
The text was updated successfully, but these errors were encountered: