Improve OpenAPI / Swagger Support for Enums and Context-Aware Required Parameters

Improve OpenAPI / Swagger Support for Enums and Context-Aware Required Parameters

1 vote

avatar

Hello,

I would like to propose two enhancements that would significantly improve the developer experience and the quality of generated OpenAPI specifications.

1 Support Enumeration Values in OpenAPI / Swagger

Current Behavior
When defining an API input model, it is currently difficult or impossible to expose a list of allowed values as an OpenAPI enum.
For example:

enum ActionType {
  ADD
  REMOVE
}
 
[Documentation()]
class GroupMembershipRequest {
  [ActionType]$Action
}


Actualy the generated Swagger schema displays:

{
  "action": "string"
}


2 Separate Required Parameters by HTTP Method Within the Same Endpoint

Current Behavior
When documenting an endpoint that supports multiple HTTP methods (for example, GET and POST), the parameters apply to all methods.
Would it be possible to have an .INPUTS parameter that is conditional on the method?

Thank you in advance.

All Comments (0)