Skip to content

Commit 9b7d341

Browse files
[OpenApi] Add non-generic JSON patch
Update the sample to include a non-generic JSON patch endpoint.
1 parent c103a03 commit 9b7d341

File tree

4 files changed

+71
-1
lines changed

4 files changed

+71
-1
lines changed

src/OpenApi/sample/Endpoints/MapSchemasEndpoints.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public static IEndpointRouteBuilder MapSchemasEndpoints(this IEndpointRouteBuild
3737
schemas.MapPost("/location", (LocationContainer location) => { });
3838
schemas.MapPost("/parent", (ParentObject parent) => Results.Ok(parent));
3939
schemas.MapPost("/child", (ChildObject child) => Results.Ok(child));
40-
schemas.MapPatch("/json-patch", (JsonPatchDocument<ParentObject> patchDoc) => Results.NoContent());
40+
schemas.MapPatch("/json-patch", (JsonPatchDocument patchDoc) => Results.NoContent());
41+
schemas.MapPatch("/json-patch-generic", (JsonPatchDocument<ParentObject> patchDoc) => Results.NoContent());
4142

4243
return endpointRouteBuilder;
4344
}

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,28 @@
509509
}
510510
},
511511
"/schemas-by-ref/json-patch": {
512+
"patch": {
513+
"tags": [
514+
"Sample"
515+
],
516+
"requestBody": {
517+
"content": {
518+
"application/json-patch+json": {
519+
"schema": {
520+
"$ref": "#/components/schemas/JsonPatchDocument"
521+
}
522+
}
523+
},
524+
"required": true
525+
},
526+
"responses": {
527+
"200": {
528+
"description": "OK"
529+
}
530+
}
531+
}
532+
},
533+
"/schemas-by-ref/json-patch-generic": {
512534
"patch": {
513535
"tags": [
514536
"Sample"
@@ -621,6 +643,7 @@
621643
}
622644
}
623645
},
646+
"JsonPatchDocument": { },
624647
"JsonPatchDocumentOfParentObject": { },
625648
"LocationContainer": {
626649
"required": [

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,28 @@
509509
}
510510
},
511511
"/schemas-by-ref/json-patch": {
512+
"patch": {
513+
"tags": [
514+
"Sample"
515+
],
516+
"requestBody": {
517+
"content": {
518+
"application/json-patch+json": {
519+
"schema": {
520+
"$ref": "#/components/schemas/JsonPatchDocument"
521+
}
522+
}
523+
},
524+
"required": true
525+
},
526+
"responses": {
527+
"200": {
528+
"description": "OK"
529+
}
530+
}
531+
}
532+
},
533+
"/schemas-by-ref/json-patch-generic": {
512534
"patch": {
513535
"tags": [
514536
"Sample"
@@ -621,6 +643,7 @@
621643
}
622644
}
623645
},
646+
"JsonPatchDocument": { },
624647
"JsonPatchDocumentOfParentObject": { },
625648
"LocationContainer": {
626649
"required": [

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,28 @@
10341034
}
10351035
},
10361036
"/schemas-by-ref/json-patch": {
1037+
"patch": {
1038+
"tags": [
1039+
"Sample"
1040+
],
1041+
"requestBody": {
1042+
"content": {
1043+
"application/json-patch+json": {
1044+
"schema": {
1045+
"$ref": "#/components/schemas/JsonPatchDocument"
1046+
}
1047+
}
1048+
},
1049+
"required": true
1050+
},
1051+
"responses": {
1052+
"200": {
1053+
"description": "OK"
1054+
}
1055+
}
1056+
}
1057+
},
1058+
"/schemas-by-ref/json-patch-generic": {
10371059
"patch": {
10381060
"tags": [
10391061
"Sample"
@@ -1410,6 +1432,7 @@
14101432
}
14111433
}
14121434
},
1435+
"JsonPatchDocument": { },
14131436
"JsonPatchDocumentOfParentObject": { },
14141437
"LocationContainer": {
14151438
"required": [

0 commit comments

Comments
 (0)