Skip to content

Commit dceea9a

Browse files
Add required for JSON Patch remove
Add `required` members to the OpenAPI schema for a JSON Patch remove operation.
1 parent da0c0f3 commit dceea9a

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ private static JsonObject CreateSchemaForJsonPatch()
170170
{
171171
[OpenApiSchemaKeywords.TypeKeyword] = "object",
172172
[OpenApiSchemaKeywords.AdditionalPropertiesKeyword] = false,
173+
[OpenApiSchemaKeywords.RequiredKeyword] = JsonArray(["op", "path"]),
173174
[OpenApiSchemaKeywords.PropertiesKeyword] = new JsonObject
174175
{
175176
["op"] = new JsonObject()

src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApi3_0/OpenApiDocumentIntegrationTests.VerifyOpenApiDocument_documentName=schemas-by-ref.verified.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,10 @@
696696
"additionalProperties": false
697697
},
698698
{
699+
"required": [
700+
"op",
701+
"path"
702+
],
699703
"type": "object",
700704
"properties": {
701705
"op": {

src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApi3_1/OpenApiDocumentIntegrationTests.VerifyOpenApiDocument_documentName=schemas-by-ref.verified.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,10 @@
696696
"additionalProperties": false
697697
},
698698
{
699+
"required": [
700+
"op",
701+
"path"
702+
],
699703
"type": "object",
700704
"properties": {
701705
"op": {

src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Integration/snapshots/OpenApiDocumentLocalizationTests.VerifyOpenApiDocumentIsInvariant.verified.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,10 @@
14851485
"additionalProperties": false
14861486
},
14871487
{
1488+
"required": [
1489+
"op",
1490+
"path"
1491+
],
14881492
"type": "object",
14891493
"properties": {
14901494
"op": {

0 commit comments

Comments
 (0)