Skip to content

Commit 2a42a29

Browse files
committed
Fixed: no additional properties in resource type
1 parent 71a72fa commit 2a42a29

File tree

11 files changed

+48
-24
lines changed

11 files changed

+48
-24
lines changed

src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceTypeSchemaGenerator.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public OpenApiSchema Get(Type resourceClrType)
4141
Enum = new List<IOpenApiAny>
4242
{
4343
new OpenApiString(resourceType.PublicName)
44-
}
44+
},
45+
AdditionalPropertiesAllowed = false
4546
};
4647

4748
string schemaId = GetSchemaId(resourceType);

test/OpenApiClientTests/LegacyClient/swagger.g.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -3470,7 +3470,8 @@
34703470
"enum": [
34713471
"airplanes"
34723472
],
3473-
"type": "string"
3473+
"type": "string",
3474+
"additionalProperties": false
34743475
},
34753476
"cabin-area": {
34763477
"enum": [
@@ -3929,7 +3930,8 @@
39293930
"enum": [
39303931
"flight-attendants"
39313932
],
3932-
"type": "string"
3933+
"type": "string",
3934+
"additionalProperties": false
39333935
},
39343936
"flight-attendant-secondary-response-document": {
39353937
"required": [
@@ -4411,7 +4413,8 @@
44114413
"enum": [
44124414
"flights"
44134415
],
4414-
"type": "string"
4416+
"type": "string",
4417+
"additionalProperties": false
44154418
},
44164419
"jsonapi-object": {
44174420
"type": "object",
@@ -4855,7 +4858,8 @@
48554858
"enum": [
48564859
"passengers"
48574860
],
4858-
"type": "string"
4861+
"type": "string",
4862+
"additionalProperties": false
48594863
},
48604864
"to-many-flight-attendant-in-request": {
48614865
"required": [

test/OpenApiClientTests/NamingConventions/CamelCase/swagger.g.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,8 @@
16031603
"enum": [
16041604
"staffMembers"
16051605
],
1606-
"type": "string"
1606+
"type": "string",
1607+
"additionalProperties": false
16071608
},
16081609
"staffMemberSecondaryResponseDocument": {
16091610
"required": [
@@ -2004,7 +2005,8 @@
20042005
"enum": [
20052006
"supermarkets"
20062007
],
2007-
"type": "string"
2008+
"type": "string",
2009+
"additionalProperties": false
20082010
},
20092011
"supermarketType": {
20102012
"enum": [

test/OpenApiClientTests/NamingConventions/KebabCase/swagger.g.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,8 @@
16031603
"enum": [
16041604
"staff-members"
16051605
],
1606-
"type": "string"
1606+
"type": "string",
1607+
"additionalProperties": false
16071608
},
16081609
"staff-member-secondary-response-document": {
16091610
"required": [
@@ -2004,7 +2005,8 @@
20042005
"enum": [
20052006
"supermarkets"
20062007
],
2007-
"type": "string"
2008+
"type": "string",
2009+
"additionalProperties": false
20082010
},
20092011
"supermarket-type": {
20102012
"enum": [

test/OpenApiClientTests/NamingConventions/PascalCase/swagger.g.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,8 @@
16031603
"enum": [
16041604
"StaffMembers"
16051605
],
1606-
"type": "string"
1606+
"type": "string",
1607+
"additionalProperties": false
16071608
},
16081609
"StaffMemberSecondaryResponseDocument": {
16091610
"required": [
@@ -2004,7 +2005,8 @@
20042005
"enum": [
20052006
"Supermarkets"
20062007
],
2007-
"type": "string"
2008+
"type": "string",
2009+
"additionalProperties": false
20082010
},
20092011
"SupermarketType": {
20102012
"enum": [

test/OpenApiClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/swagger.g.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,8 @@
15741574
"enum": [
15751575
"empties"
15761576
],
1577-
"type": "string"
1577+
"type": "string",
1578+
"additionalProperties": false
15781579
},
15791580
"linksInRelationshipObject": {
15801581
"required": [
@@ -2239,7 +2240,8 @@
22392240
"enum": [
22402241
"resources"
22412242
],
2242-
"type": "string"
2243+
"type": "string",
2244+
"additionalProperties": false
22432245
},
22442246
"toManyEmptyInRequest": {
22452247
"required": [

test/OpenApiClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/swagger.g.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,8 @@
16051605
"enum": [
16061606
"empties"
16071607
],
1608-
"type": "string"
1608+
"type": "string",
1609+
"additionalProperties": false
16091610
},
16101611
"emptySecondaryResponseDocument": {
16111612
"required": [
@@ -2293,7 +2294,8 @@
22932294
"enum": [
22942295
"resources"
22952296
],
2296-
"type": "string"
2297+
"type": "string",
2298+
"additionalProperties": false
22972299
},
22982300
"toManyEmptyInRequest": {
22992301
"required": [

test/OpenApiClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/swagger.g.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,8 @@
20732073
"enum": [
20742074
"empties"
20752075
],
2076-
"type": "string"
2076+
"type": "string",
2077+
"additionalProperties": false
20772078
},
20782079
"emptySecondaryResponseDocument": {
20792080
"required": [
@@ -2834,7 +2835,8 @@
28342835
"enum": [
28352836
"resources"
28362837
],
2837-
"type": "string"
2838+
"type": "string",
2839+
"additionalProperties": false
28382840
},
28392841
"toManyEmptyInRequest": {
28402842
"required": [

test/OpenApiClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/swagger.g.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,8 @@
20732073
"enum": [
20742074
"empties"
20752075
],
2076-
"type": "string"
2076+
"type": "string",
2077+
"additionalProperties": false
20772078
},
20782079
"emptySecondaryResponseDocument": {
20792080
"required": [
@@ -2828,7 +2829,8 @@
28282829
"enum": [
28292830
"resources"
28302831
],
2831-
"type": "string"
2832+
"type": "string",
2833+
"additionalProperties": false
28322834
},
28332835
"toManyEmptyInRequest": {
28342836
"required": [

test/OpenApiEndToEndTests/QueryStrings/swagger.g.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,8 @@
13871387
"enum": [
13881388
"nodes"
13891389
],
1390-
"type": "string"
1390+
"type": "string",
1391+
"additionalProperties": false
13911392
},
13921393
"nullableNodeIdentifierResponseDocument": {
13931394
"required": [

test/OpenApiTests/LegacyOpenApiIntegration/swagger.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -3470,7 +3470,8 @@
34703470
"enum": [
34713471
"airplanes"
34723472
],
3473-
"type": "string"
3473+
"type": "string",
3474+
"additionalProperties": false
34743475
},
34753476
"cabin-area": {
34763477
"enum": [
@@ -3929,7 +3930,8 @@
39293930
"enum": [
39303931
"flight-attendants"
39313932
],
3932-
"type": "string"
3933+
"type": "string",
3934+
"additionalProperties": false
39333935
},
39343936
"flight-attendant-secondary-response-document": {
39353937
"required": [
@@ -4411,7 +4413,8 @@
44114413
"enum": [
44124414
"flights"
44134415
],
4414-
"type": "string"
4416+
"type": "string",
4417+
"additionalProperties": false
44154418
},
44164419
"jsonapi-object": {
44174420
"type": "object",
@@ -4855,7 +4858,8 @@
48554858
"enum": [
48564859
"passengers"
48574860
],
4858-
"type": "string"
4861+
"type": "string",
4862+
"additionalProperties": false
48594863
},
48604864
"to-many-flight-attendant-in-request": {
48614865
"required": [

0 commit comments

Comments
 (0)