Skip to content

Commit 2f5c3a8

Browse files
authored
fix: update codegen and fix verify script (#430)
The refactor introduced in #413 caused a bug in the verify script which resulted in an outdated schema after #419. This fixes the schema and the verify script.
1 parent 7e01535 commit 2f5c3a8

File tree

2 files changed

+60
-46
lines changed

2 files changed

+60
-46
lines changed

file/kong_json_schema.json

+57-44
Original file line numberDiff line numberDiff line change
@@ -260,19 +260,7 @@
260260
}
261261
},
262262
"additionalProperties": false,
263-
"type": "object",
264-
"anyOf": [
265-
{
266-
"required": [
267-
"username"
268-
]
269-
},
270-
{
271-
"required": [
272-
"id"
273-
]
274-
}
275-
]
263+
"type": "object"
276264
},
277265
"FCACertificate": {
278266
"required": [
@@ -640,7 +628,6 @@
640628
"type": "boolean"
641629
},
642630
"service": {
643-
"$schema": "http://json-schema.org/draft-04/schema#",
644631
"$ref": "#/definitions/Service"
645632
},
646633
"snis": {
@@ -651,7 +638,6 @@
651638
},
652639
"sources": {
653640
"items": {
654-
"$schema": "http://json-schema.org/draft-04/schema#",
655641
"$ref": "#/definitions/CIDRPort"
656642
},
657643
"type": "array"
@@ -847,7 +833,6 @@
847833
"type": "string"
848834
},
849835
"upstream": {
850-
"$schema": "http://json-schema.org/draft-04/schema#",
851836
"$ref": "#/definitions/Upstream"
852837
},
853838
"weight": {
@@ -890,7 +875,6 @@
890875
"type": "string"
891876
},
892877
"healthchecks": {
893-
"$schema": "http://json-schema.org/draft-04/schema#",
894878
"$ref": "#/definitions/Healthcheck"
895879
},
896880
"host_header": {
@@ -1007,6 +991,10 @@
1007991
},
1008992
"Info": {
1009993
"properties": {
994+
"defaults": {
995+
"$schema": "http://json-schema.org/draft-04/schema#",
996+
"$ref": "#/definitions/KongDefaults"
997+
},
1010998
"select_tags": {
1011999
"items": {
10121000
"type": "string"
@@ -1094,6 +1082,28 @@
10941082
"additionalProperties": false,
10951083
"type": "object"
10961084
},
1085+
"KongDefaults": {
1086+
"properties": {
1087+
"route": {
1088+
"$schema": "http://json-schema.org/draft-04/schema#",
1089+
"$ref": "#/definitions/Route"
1090+
},
1091+
"service": {
1092+
"$schema": "http://json-schema.org/draft-04/schema#",
1093+
"$ref": "#/definitions/Service"
1094+
},
1095+
"target": {
1096+
"$schema": "http://json-schema.org/draft-04/schema#",
1097+
"$ref": "#/definitions/Target"
1098+
},
1099+
"upstream": {
1100+
"$schema": "http://json-schema.org/draft-04/schema#",
1101+
"$ref": "#/definitions/Upstream"
1102+
}
1103+
},
1104+
"additionalProperties": false,
1105+
"type": "object"
1106+
},
10971107
"MTLSAuth": {
10981108
"required": [
10991109
"id",
@@ -1285,6 +1295,7 @@
12851295
},
12861296
"sources": {
12871297
"items": {
1298+
"$schema": "http://json-schema.org/draft-04/schema#",
12881299
"$ref": "#/definitions/CIDRPort"
12891300
},
12901301
"type": "array"
@@ -1303,19 +1314,7 @@
13031314
}
13041315
},
13051316
"additionalProperties": false,
1306-
"type": "object",
1307-
"anyOf": [
1308-
{
1309-
"required": [
1310-
"name"
1311-
]
1312-
},
1313-
{
1314-
"required": [
1315-
"id"
1316-
]
1317-
}
1318-
]
1317+
"type": "object"
13191318
},
13201319
"SNI": {
13211320
"properties": {
@@ -1350,6 +1349,7 @@
13501349
"type": "array"
13511350
},
13521351
"client_certificate": {
1352+
"$schema": "http://json-schema.org/draft-04/schema#",
13531353
"$ref": "#/definitions/Certificate"
13541354
},
13551355
"connect_timeout": {
@@ -1405,19 +1405,34 @@
14051405
}
14061406
},
14071407
"additionalProperties": false,
1408-
"type": "object",
1409-
"anyOf": [
1410-
{
1411-
"required": [
1412-
"name"
1413-
]
1408+
"type": "object"
1409+
},
1410+
"Target": {
1411+
"properties": {
1412+
"created_at": {
1413+
"type": "number"
14141414
},
1415-
{
1416-
"required": [
1417-
"id"
1418-
]
1415+
"id": {
1416+
"type": "string"
1417+
},
1418+
"tags": {
1419+
"items": {
1420+
"type": "string"
1421+
},
1422+
"type": "array"
1423+
},
1424+
"target": {
1425+
"type": "string"
1426+
},
1427+
"upstream": {
1428+
"$ref": "#/definitions/Upstream"
1429+
},
1430+
"weight": {
1431+
"type": "integer"
14191432
}
1420-
]
1433+
},
1434+
"additionalProperties": false,
1435+
"type": "object"
14211436
},
14221437
"Unhealthy": {
14231438
"properties": {
@@ -1444,9 +1459,6 @@
14441459
"type": "object"
14451460
},
14461461
"Upstream": {
1447-
"required": [
1448-
"name"
1449-
],
14501462
"properties": {
14511463
"algorithm": {
14521464
"type": "string"
@@ -1476,6 +1488,7 @@
14761488
"type": "string"
14771489
},
14781490
"healthchecks": {
1491+
"$schema": "http://json-schema.org/draft-04/schema#",
14791492
"$ref": "#/definitions/Healthcheck"
14801493
},
14811494
"host_header": {

scripts/verify-codegen.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash -e
22

3-
cp file/schema.go /tmp/schema.go
3+
FILE="kong_json_schema.json"
4+
cp file/${FILE} /tmp/${FILE}
45
go generate ./...
56

6-
diff -u /tmp/schema.go file/schema.go
7+
diff -u /tmp/${FILE} file/${FILE}

0 commit comments

Comments
 (0)