Skip to content

Commit

Permalink
Update JSON Validation workflow for ajv 7 (OWASP#340)
Browse files Browse the repository at this point in the history
- Auto-format `tools_schema.json`.
- Tweak `validate-tools-json.yml` to install additional formats module
and change command syntax to accommodate ajv functinoal changes.

Signed-off-by: kingthorin <kingthorin@users.noreply.github.com>
  • Loading branch information
Rick M authored Dec 23, 2020
1 parent 9ff5076 commit 28c2068
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/validate-tools-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ jobs:
with:
node-version: 13.x
- name: Install dependencies
run: npm install -g ajv-cli
run: |
npm install -g ajv-formats
npm install -g ajv-cli
- name: Run schema check
run: |
ajv validate -s tools_schema.json -d _data/tools.json --all-errors --error-data-path=property --verbose=true 1> log.txt 2>&1
ajv validate -s tools_schema.json -d _data/tools.json --all-errors --errors=text --verbose=true -c=ajv-formats 1> log.txt 2>&1
- name: Show Validation Issues
id: validation
if: failure()
Expand Down
53 changes: 27 additions & 26 deletions tools_schema.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Root",
"definitions": {
},
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Root",
"type": "array",
"default": [],
"items":{
"$id": "#root/items",
"title": "Items",
"default": [
],
"items": {
"$id": "#root/items",
"title": "Items",
"type": "object",
"required": [
"title",
Expand All @@ -19,19 +21,19 @@
],
"properties": {
"title": {
"$id": "#root/items/title",
"title": "Title",
"$id": "#root/items/title",
"title": "Title",
"type": "string"
},
"url": {
"$id": "#root/items/url",
"title": "Url",
"$id": "#root/items/url",
"title": "Url",
"type": "string",
"format": "uri"
"format": "uri"
},
"owner": {
"$id": "#root/items/owner",
"title": "Owner",
"$id": "#root/items/owner",
"title": "Owner",
"oneOf": [
{
"type": "null"
Expand All @@ -42,19 +44,19 @@
]
},
"license": {
"$id": "#root/items/license",
"title": "License",
"$id": "#root/items/license",
"title": "License",
"type": "string",
"enum": [
"enum": [
"Free",
"Commercial",
"Open Source",
"Open Source or Free"
]
},
"platforms": {
"$id": "#root/items/platforms",
"title": "Platforms",
"$id": "#root/items/platforms",
"title": "Platforms",
"oneOf": [
{
"type": "null"
Expand All @@ -65,8 +67,8 @@
]
},
"note": {
"$id": "#root/items/note",
"title": "Note",
"$id": "#root/items/note",
"title": "Note",
"oneOf": [
{
"type": "null"
Expand All @@ -77,15 +79,14 @@
]
},
"type": {
"$id": "#root/items/type",
"title": "Type",
"$id": "#root/items/type",
"title": "Type",
"type": "string",
"enum": [
"enum": [
"DAST",
"SAST"
]
}
}
}

}
}

0 comments on commit 28c2068

Please sign in to comment.