JSON Patch request body should use content-type application/json-patch+json #61956
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
Describe the bug
A patch operation that accepts a
JsonPatchDocument<T>
that was added as part of the JSON Patch with System.Text.Json feature in .NET 10 preview 4 is shown in the generated OpenAPI document as accepting the media type "application/json". According to RFC 6902, the media type should be "application/json-patch+json".Expected Behavior
A patch operation that accepts a
JsonPatchDocument<T>
should have a request body with media type "application/json-patch+json" in the generated OpenAPI document.Steps To Reproduce
A minimal repro for this problem is in the "json-patch-media-type" directory of this repo:
https://github.com/mikekistler/dotnet10-issue-repros
Exceptions (if any)
No response
.NET Version
10.0.100-preview.4.25258.110
Implementation Plan
The
JsonPatchDocument
type should implement theIEndpointParameterMetadataProvider
interface and add the appropriateAcceptsMetadata
with the "application/json-patch+json" content-type. Test coverage should be added to assert the correct behavior of the type when used in an OpenAPI document by adding an endpoint that takes a JsonPatchDocument to this test file (https://github.com/dotnet/aspnetcore/blob/c5d6996bd22e916b04aa792185b2fd2214ae22fe/src/OpenApi/sample/Endpoints/MapSchemasEndpoints.cs) and updating the snapshot tests.The text was updated successfully, but these errors were encountered: