Description
Is there an existing issue for this?
- I have searched the existing issues
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 the IEndpointParameterMetadataProvider
interface and add the appropriate AcceptsMetadata
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.