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

Microsoft.AspNetCore.OpenApi Handling Of Mvc Json Options #60145

Open
1 task done
RyanThomas73 opened this issue Jan 31, 2025 · 0 comments
Open
1 task done

Microsoft.AspNetCore.OpenApi Handling Of Mvc Json Options #60145

RyanThomas73 opened this issue Jan 31, 2025 · 0 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-openapi

Comments

@RyanThomas73
Copy link

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.

Related issue: #57891

Problem:
For an AspNetCore.Mvc api, the request and response json serializer settings are configured using an options specific to the AspNetCore.Mvc packages.

In the Microsoft.AspNetCore.OpenApi packages, the open api document services rely solely on the Microsoft.AspNetCore.Http.Json.JsonOptions value to control json serializer settings. As mentioned in the related issue, this was done to avoid the need to reference the .Mvc packages from the OpenApi packages.

However, requiring consumers to always change their Microsoft.AspNetCore.Http.Json.JsonOptions to match their Mvc ones in order for the open api spec doc generation to work is not viable in many situations. Changing the Microsoft.AspNetCore.Http.Json.JsonOptions has additional ramifications as it would also change behavior of outbound http calls from an aspnet core mvc api to other services.

Describe the solution you'd like

  • The Microsoft.AspNetCore.OpenApi packages should support json options configuration independently of the overall Microsoft.AspNetCore.Http.Json.JsonOptions configuration.
  • Continuing to default the values to match those of the service container's Http.Json.JsonOptions would be acceptable, but the AddOpenApi() service collection extension methods should support specifying the options to use without requiring a global default change to the behavior of the application

Additional context

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-openapi
Projects
None yet
Development

No branches or pull requests

2 participants