Skip to content

Commit

Permalink
workflows:check-json - check schemata dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoCampinoti94 committed Nov 3, 2023
1 parent 1713ed6 commit 077459a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/check-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,15 @@ jobs:
uses: limitusus/json-syntax-check@v2
with:
pattern: "\\.json$"
- name: Check Actions Schema
run: python -c 'import yaml,json,jsonschema,sys;jsonschema.validate(yaml.load(open(sys.argv[1]), yaml.Loader), json.load(open(sys.argv[2])))' fileformats.yml fileformats.schema.json
- name: Check JSON Schemata
run: |
for schema in *.schema.json; do
[[ -f "${schema%.schema.json}.json" ]] && python3 -c 'import json,jsonschema,sys;jsonschema.validate(json.load(open(sys.argv[1])), json.load(open(sys.argv[2])))' "${schema%.schema.json}.json" "$schema";
done
- name: Check YAML Schemata
run: |
for schema in *.schema.json; do
for ext in "yaml" "yml"; do
[[ -f "${schema%.schema.json}.$ext" ]] && python3 -c 'import yaml,json,jsonschema,sys;jsonschema.validate(yaml.load(open(sys.argv[1]), yaml.Loader), json.load(open(sys.argv[2])))' "${schema%.schema.json}.$ext" "$schema";
done
done

0 comments on commit 077459a

Please sign in to comment.