Consider a nicer API for configuring JsonOptions for minimal actions / route-to-code #39226
Labels
api-approved
API was approved in API review, it can be implemented
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
area-web-frameworks
*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Docs
This issue tracks updating documentation
feature-minimal-actions
Controller-like actions for endpoint routing
Milestone
Background and Motivation
The current way to configure JsonOptions for minimal is by configuring the
Microsoft.AspNetCore.Http.Json.JsonOptions
instance. From our docs, here's what this looks like:Note that
a) You have to include a not too well-known namespace
b) There's also a
Microsoft.AspNetCore.Mvc.JsonOptions
type in the framework, so if you had previously imported the Mvc namespace, you'd be configuring the wrongJsonOptions
type.This makes it ripe for failure. We could consider adding a first class helper API to allow configuring this
Proposed API
Usage Examples
Alternative Designs
Risks
Users might be confused why configuring this option does not affect controller actions since this is API is much more accessible. I feel a documentation page that describes all the different JSON things that can be configured in ASP.NET Core might help mitigate this.
The text was updated successfully, but these errors were encountered: