-
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (73 loc) · 3.22 KB
/
validate-schemas.yml
File metadata and controls
82 lines (73 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Validate Schemas
on:
push:
paths:
- 'schemas/**'
- 'examples/**'
- '.github/workflows/validate-schemas.yml'
pull_request:
paths:
- 'schemas/**'
- 'examples/**'
- '.github/workflows/validate-schemas.yml'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install ajv-cli
run: npm install -g ajv-cli ajv-formats
- name: Validate schemas compile
run: |
# Compile standalone schemas
for f in schemas/anchor.schema.json schemas/asset-index.schema.json \
schemas/content.schema.json schemas/dublin-core.schema.json \
schemas/manifest.schema.json schemas/precise-layout.schema.json \
schemas/presentation.schema.json schemas/provenance.schema.json; do
echo "Compiling $f..."
ajv compile -s "$f" --spec=draft2020 --strict=false
done
# Compile schemas with cross-references (need -r for referenced schemas)
echo "Compiling schemas/annotations.schema.json..."
ajv compile -s schemas/annotations.schema.json \
-r schemas/anchor.schema.json --spec=draft2020 --strict=false
echo "Compiling schemas/phantoms.schema.json..."
ajv compile -s schemas/phantoms.schema.json \
-r schemas/anchor.schema.json --spec=draft2020 --strict=false
- name: Validate example documents
run: |
# Validate simple-document
ajv validate -s schemas/manifest.schema.json \
-d examples/simple-document/manifest.json \
--spec=draft2020 --strict=false
ajv validate -s schemas/content.schema.json \
-d examples/simple-document/content/document.json \
--spec=draft2020 --strict=false
ajv validate -s schemas/dublin-core.schema.json \
-d examples/simple-document/metadata/dublin-core.json \
--spec=draft2020 --strict=false
# Validate signed-document
ajv validate -s schemas/manifest.schema.json \
-d examples/signed-document/manifest.json \
--spec=draft2020 --strict=false
ajv validate -s schemas/content.schema.json \
-d examples/signed-document/content/document.json \
--spec=draft2020 --strict=false
ajv validate -s schemas/dublin-core.schema.json \
-d examples/signed-document/metadata/dublin-core.json \
--spec=draft2020 --strict=false
# Validate comprehensive-document (if exists)
if [ -d examples/comprehensive-document ]; then
ajv validate -s schemas/manifest.schema.json \
-d examples/comprehensive-document/manifest.json \
--spec=draft2020 --strict=false
ajv validate -s schemas/content.schema.json \
-d examples/comprehensive-document/content/document.json \
--spec=draft2020 --strict=false
ajv validate -s schemas/dublin-core.schema.json \
-d examples/comprehensive-document/metadata/dublin-core.json \
--spec=draft2020 --strict=false
fi