Describe the issue
Incorrect schema generated for PATCH requests when using Microsoft.AspNetCore.JsonPatch library
Steps to reproduce the behavior:
Create a PATCH endpoint with request body type as JsonPatchDocument
Run the application and open Swagger UI
Go to PATCH endpoint
The expected schema is
[
{
"op": "string",
"value": {},
"path": "string"
}
]
but generated is
{
"operations": [
{
"op": "string",
"value": {},
"path": "string"
}
]
}
If we send request with the generated schema the JsonPatch libaray throws the following error: "The JSON patch document was malformed and could not be parsed."
Describe the issue Incorrect schema generated for PATCH requests when using Microsoft.AspNetCore.JsonPatch library
Steps to reproduce the behavior:
If we send request with the generated schema the JsonPatch libaray throws the following error: "The JSON patch document was malformed and could not be parsed."
test from jsonpatch library stating "operations" property is unexpected : https://github.com/dotnet/aspnetcore/blob/13a7e9d7223e2041fa4efa0aebf1a7c375a5670f/src/Features/JsonPatch/test/JsonPatchDocumentTest.cs#L129
This issue has been reported in https://michael-mckenna.com/swagger-with-asp-net-core-3-1-json-patch/ and a workaround is suggested.