Skip to content

Commit 63a8135

Browse files
authored
Replace JSON validator in workflow (#1247)
* Add alternative validator for testing * Update alt-validate.yml * Update alt-validate.yml * Update samples.schema.json * Update alt-validate.yml * Trying another validator * Update samples.schema.json * Update samples.schema.json * Adding invalid property for testing * Update sample-queries.json * Replace JSON validator
1 parent 797d9d3 commit 63a8135

File tree

2 files changed

+77
-76
lines changed

2 files changed

+77
-76
lines changed

.github/workflows/validate.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
name: Validate sample queries
22
on:
3+
workflow_dispatch:
4+
35
push:
46
paths:
57
- sample-queries/sample-queries.json
68
- scripts/**
79
- tests/**
810
- package.json
911
- package-lock.json
12+
1013
pull_request:
1114
paths:
1215
- sample-queries/sample-queries.json
@@ -19,18 +22,19 @@ jobs:
1922
validate-json-schema:
2023
runs-on: ubuntu-latest
2124
steps:
22-
- uses: actions/checkout@v1
23-
- name: Validate json schema
24-
uses: docker://orrosenblatt/validate-json-action:latest
25-
env:
26-
INPUT_SCHEMA: /tests/samples.schema.json
27-
INPUT_JSONS: /sample-queries/sample-queries.json
25+
- uses: actions/checkout@v5
26+
27+
- name: Validate JSON schema
28+
uses: dsanders11/[email protected]
29+
with:
30+
schema: tests/samples.schema.json
31+
files: sample-queries/sample-queries.json
2832

2933
test:
3034
runs-on: ubuntu-latest
3135
needs: validate-json-schema
3236
steps:
33-
- uses: actions/checkout@v2
37+
- uses: actions/checkout@v5
3438

3539
- name: Install
3640
run: npm install

tests/samples.schema.json

Lines changed: 66 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,78 @@
11
{
2+
"$schema": "https://json-schema.org/draft/2019-09/schema",
23
"type": "object",
34
"properties": {
45
"SampleQueries": {
56
"type": "array",
6-
"items": [
7-
{
8-
"type": "object",
9-
"properties": {
10-
"id": {
11-
"type": "string",
12-
"format": "uuid"
13-
},
14-
"category": {
15-
"type": "string"
16-
},
17-
"method": {
18-
"type": "string",
19-
"enum": [
20-
"GET",
21-
"POST",
22-
"PUT",
23-
"PATCH",
24-
"DELETE"
25-
]
26-
},
27-
"humanName": {
28-
"type": "string"
29-
},
30-
"requestUrl": {
31-
"type": "string"
32-
},
33-
"docLink": {
34-
"type": "string",
35-
"format": "uri"
36-
},
37-
"tip": {
38-
"type": "string"
39-
},
40-
"postBody": {
41-
"type": "string"
42-
},
43-
"headers": {
44-
"type": "array",
45-
"items": [
46-
{
47-
"type": "object",
48-
"properties": {
49-
"name": {
50-
"type": "string"
51-
},
52-
"value": {
53-
"type": "string"
54-
}
55-
},
56-
"additionalProperties": false,
57-
"required": [
58-
"name",
59-
"value"
60-
]
7+
"items": {
8+
"type": "object",
9+
"properties": {
10+
"id": {
11+
"type": "string",
12+
"format": "uuid"
13+
},
14+
"category": {
15+
"type": "string"
16+
},
17+
"method": {
18+
"type": "string",
19+
"enum": [
20+
"GET",
21+
"POST",
22+
"PUT",
23+
"PATCH",
24+
"DELETE"
25+
]
26+
},
27+
"humanName": {
28+
"type": "string"
29+
},
30+
"requestUrl": {
31+
"type": "string"
32+
},
33+
"docLink": {
34+
"type": "string",
35+
"format": "uri"
36+
},
37+
"tip": {
38+
"type": "string"
39+
},
40+
"postBody": {
41+
"type": "string"
42+
},
43+
"headers": {
44+
"type": "array",
45+
"items": {
46+
"type": "object",
47+
"properties": {
48+
"name": {
49+
"type": "string"
50+
},
51+
"value": {
52+
"type": "string"
6153
}
54+
},
55+
"additionalProperties": false,
56+
"required": [
57+
"name",
58+
"value"
6259
]
63-
},
64-
"skipTest": {
65-
"type": "boolean"
6660
}
6761
},
68-
"additionalProperties": false,
69-
"required": [
70-
"id",
71-
"category",
72-
"method",
73-
"humanName",
74-
"requestUrl",
75-
"docLink"
76-
]
77-
}
78-
]
62+
"skipTest": {
63+
"type": "boolean"
64+
}
65+
},
66+
"additionalProperties": false,
67+
"required": [
68+
"id",
69+
"category",
70+
"method",
71+
"humanName",
72+
"requestUrl",
73+
"docLink"
74+
]
75+
}
7976
}
8077
},
8178
"additionalProperties": false,

0 commit comments

Comments
 (0)