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

Allow OpenAPI's response descriptions to be set using Minimal API #57963

Closed
1 task done
sander1095 opened this issue Sep 19, 2024 · 6 comments
Closed
1 task done

Allow OpenAPI's response descriptions to be set using Minimal API #57963

sander1095 opened this issue Sep 19, 2024 · 6 comments
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc

Comments

@sander1095
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am currently working on #55656 to add better OpenAPI description support to API responses using [ProducesResponseType] and other related attributes with MVC (Controllers).

As you can see in the comments, that issue excludes Minimal API support. Quoting @captainsafia :

That part of the API proposal was rejected because it would've been difficult to update the existing Produces extension methods in a way that is source compatible. The only API that was approved is the new Description property on the interfaces and concrete implementations.

Describe the solution you'd like

This feature request extends Minimal API's OpenAPI's Produces.. and other methods to accept a new optional, null-by-default description parameter.

Additional context

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels label Sep 19, 2024
@captainsafia captainsafia added area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc and removed area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels labels Sep 19, 2024
@sander1095 sander1095 changed the title Allow OpenAPI's description to be set using Minimal API Allow OpenAPI's response descriptions to be set using Minimal API Oct 15, 2024
@Ducki
Copy link
Contributor

Ducki commented Oct 23, 2024

Is there any workaround for this?

@martincostello
Copy link
Member

You could use the ProducesOpenApiResponse() in this library of mine, or alternatively write your own operation/document transformer that does the equivalent customisation of the response description(s).

@sander1095
Copy link
Contributor Author

Hi @martincostello ! I know you do a lot of work with ASP.NET Core and OpenAPI.

I'd like to ask you what we can do about this source-incompatibility problem. I would love to create a PR for this issue, but I could only present an API proposal when I know how I could work around the mentioned problem. Could you help me figure this out?

@martincostello
Copy link
Member

I think that's something for the ASP.NET Core to give a steer on, as they'd have to approve any API additions to make this work.

@sander1095
Copy link
Contributor Author

/cc @captainsafia

@sander1095
Copy link
Contributor Author

I've decided to close this issue as my design proposal contains more information and context: #58724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Projects
None yet
Development

No branches or pull requests

4 participants