Skip to content

Commit e81b44f

Browse files
committed
feat: add schema validation for data (#76)
1 parent 913555f commit e81b44f

File tree

7 files changed

+316
-4
lines changed

7 files changed

+316
-4
lines changed

.github/workflows/ci.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,33 @@ permissions:
1212
id-token: write
1313

1414
jobs:
15+
validate:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout your repository using git
19+
uses: actions/checkout@v4
20+
- name: Setup Python
21+
uses: actions/[email protected]
22+
with:
23+
python-version: "3.x"
24+
- name: Install check-jsonschema
25+
run: pip install check-jsonschema
26+
- name: Validate Guide only Custom Formats
27+
run: |
28+
EXIT=0
29+
for f in data/*; do
30+
if [[ "$f" == "data/conferences.json" ]]; then
31+
check-jsonschema -v --schemafile schema/conferences.json "data/conferences.json" || EXIT=1
32+
else
33+
check-jsonschema -v --schemafile schema/community.json "$f" || EXIT=1
34+
fi
35+
done
36+
37+
exit $EXIT
38+
1539
build:
1640
runs-on: ubuntu-latest
41+
needs: validate
1742
steps:
1843
- name: Checkout your repository using git
1944
uses: actions/checkout@v4

data/AFSYSfPots.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"tooltip": "Web site",
1414
"url": "http://www.meetup.com/afsy-sfpot/"
1515
}
16-
]
16+
],
17+
"patternsGoogleCalendar": []
1718
}

data/CocoaHeads.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
"tooltip": "Git Hub Organization",
2626
"url": "https://github.com/cocoaheadslyon"
2727
}
28-
]
28+
],
29+
"patternsGoogleCalendar": []
2930
}

data/LyonGameDev.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@
3434
"tooltip": "Git Hub Organization",
3535
"url": "https://github.com/lyongamedev"
3636
}
37-
]
37+
],
38+
"patternsGoogleCalendar": []
3839
}

data/hckrs.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
"tooltip": "Git Hub Organization",
2626
"url": "https://github.com/hckrs/hckrs.io"
2727
}
28-
]
28+
],
29+
"patternsGoogleCalendar": []
2930
}

schema/community.json

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "object",
4+
"properties": {
5+
"image": {
6+
"type": "string"
7+
},
8+
"name": {
9+
"type": "string"
10+
},
11+
"shortDescription": {
12+
"type": "string"
13+
},
14+
"tags": {
15+
"type": "array",
16+
"items": [
17+
{
18+
"type": "string"
19+
},
20+
{
21+
"type": "string"
22+
},
23+
{
24+
"type": "string"
25+
}
26+
]
27+
},
28+
"patternsGoogleCalendar": {
29+
"type": "array",
30+
"items": [
31+
{
32+
"type": "string"
33+
},
34+
{
35+
"type": "string"
36+
}
37+
]
38+
},
39+
"socialLinks": {
40+
"type": "array",
41+
"items": [
42+
{
43+
"type": "object",
44+
"properties": {
45+
"icon": {
46+
"type": "string"
47+
},
48+
"tooltip": {
49+
"type": "string"
50+
},
51+
"url": {
52+
"type": "string"
53+
}
54+
},
55+
"required": [
56+
"icon",
57+
"tooltip",
58+
"url"
59+
]
60+
},
61+
{
62+
"type": "object",
63+
"properties": {
64+
"icon": {
65+
"type": "string"
66+
},
67+
"tooltip": {
68+
"type": "string"
69+
},
70+
"url": {
71+
"type": "string"
72+
}
73+
},
74+
"required": [
75+
"icon",
76+
"tooltip",
77+
"url"
78+
]
79+
},
80+
{
81+
"type": "object",
82+
"properties": {
83+
"icon": {
84+
"type": "string"
85+
},
86+
"tooltip": {
87+
"type": "string"
88+
},
89+
"url": {
90+
"type": "string"
91+
}
92+
},
93+
"required": [
94+
"icon",
95+
"tooltip",
96+
"url"
97+
]
98+
}
99+
]
100+
},
101+
"slackChannels": {
102+
"type": "array",
103+
"items": [
104+
{
105+
"type": "string"
106+
}
107+
]
108+
}
109+
},
110+
"required": [
111+
"image",
112+
"name",
113+
"shortDescription",
114+
"tags",
115+
"patternsGoogleCalendar",
116+
"socialLinks"
117+
]
118+
}

schema/conferences.json

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "array",
4+
"items": [
5+
{
6+
"type": "object",
7+
"properties": {
8+
"image": {
9+
"type": "string"
10+
},
11+
"key": {
12+
"type": "string"
13+
},
14+
"name": {
15+
"type": "string"
16+
},
17+
"url": {
18+
"type": "string"
19+
},
20+
"shortDescription": {
21+
"type": "string"
22+
},
23+
"tags": {
24+
"type": "array",
25+
"items": [
26+
{
27+
"type": "string"
28+
},
29+
{
30+
"type": "string"
31+
},
32+
{
33+
"type": "string"
34+
},
35+
{
36+
"type": "string"
37+
}
38+
]
39+
}
40+
},
41+
"required": [
42+
"image",
43+
"key",
44+
"name",
45+
"url",
46+
"shortDescription",
47+
"tags"
48+
]
49+
},
50+
{
51+
"type": "object",
52+
"properties": {
53+
"image": {
54+
"type": "string"
55+
},
56+
"key": {
57+
"type": "string"
58+
},
59+
"name": {
60+
"type": "string"
61+
},
62+
"url": {
63+
"type": "string"
64+
},
65+
"shortDescription": {
66+
"type": "string"
67+
},
68+
"tags": {
69+
"type": "array",
70+
"items": [
71+
{
72+
"type": "string"
73+
},
74+
{
75+
"type": "string"
76+
},
77+
{
78+
"type": "string"
79+
},
80+
{
81+
"type": "string"
82+
},
83+
{
84+
"type": "string"
85+
},
86+
{
87+
"type": "string"
88+
},
89+
{
90+
"type": "string"
91+
},
92+
{
93+
"type": "string"
94+
},
95+
{
96+
"type": "string"
97+
},
98+
{
99+
"type": "string"
100+
},
101+
{
102+
"type": "string"
103+
},
104+
{
105+
"type": "string"
106+
},
107+
{
108+
"type": "string"
109+
}
110+
]
111+
}
112+
},
113+
"required": [
114+
"image",
115+
"key",
116+
"name",
117+
"url",
118+
"shortDescription",
119+
"tags"
120+
]
121+
},
122+
{
123+
"type": "object",
124+
"properties": {
125+
"image": {
126+
"type": "string"
127+
},
128+
"key": {
129+
"type": "string"
130+
},
131+
"name": {
132+
"type": "string"
133+
},
134+
"url": {
135+
"type": "string"
136+
},
137+
"shortDescription": {
138+
"type": "string"
139+
},
140+
"tags": {
141+
"type": "array",
142+
"items": [
143+
{
144+
"type": "string"
145+
},
146+
{
147+
"type": "string"
148+
},
149+
{
150+
"type": "string"
151+
}
152+
]
153+
}
154+
},
155+
"required": [
156+
"image",
157+
"key",
158+
"name",
159+
"url",
160+
"shortDescription",
161+
"tags"
162+
]
163+
}
164+
]
165+
}

0 commit comments

Comments
 (0)