Add GitHub Action to validate apps.json against schema.json

Signed-off-by: kingthorin <kingthorin@users.noreply.github.com>
main
kingthorin 5 years ago
parent b93fb690d4
commit 1dc00388a2

@ -0,0 +1,32 @@
name: JSON Schema Check
on:
pull_request:
branches:
- master
paths:
- 'src/apps.json'
jobs:
schema-check:
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Setup Action
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 13.x
- name: Install dependencies
run: npm install -g ajv-cli
- name: Run schema check
run: |
ajv validate -s schema.json -d src/apps.json
# - name: Upload list of broken links
# if: failure() && github.event_name == 'pull_request'
# uses: actions/upload-artifact@v1
# with:
# name: broken-links
# path: brokenlinks.txt

@ -2,18 +2,18 @@
"title": "Wappalyzer Schema", "title": "Wappalyzer Schema",
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"required": ["categories","apps"],
"properties": { "properties": {
"$schema": { "$schema": {
"type": "string" "type": "string"
}, },
"categories": { "categories": {
"type": "object", "type": "object",
"required": true, "minProperties": 64,
"additionalProperties": false, "additionalProperties": false,
"patternProperties": { "patternProperties": {
"^[0-9]+$": { "^[0-9]+$": {
"type": "object", "type": "object",
"required": true,
"properties": { "properties": {
"priority": { "priority": {
"type": "number" "type": "number"
@ -27,89 +27,136 @@
}, },
"apps": { "apps": {
"type": "object", "type": "object",
"required": true,
"additionalProperties": { "additionalProperties": {
"additionalProperties": false, "additionalProperties": false,
"required": ["cats","website"],
"properties": { "properties": {
"cats": { "cats": {
"type": "array", "type": "array",
"items": { "items": {
"type": "number" "type": "number"
}, },
"required": true "minItems": 1
}, },
"cpe": { "cpe": {
"type": "string" "type": "string",
"pattern": "^(?!\\s*$).+"
}, },
"cookies": { "cookies": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": false,
"type": "string" "patternProperties": {
"^.+$": {
},
"additionalProperties": {
"type": "string"
}
} }
}, },
"js": { "js": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": false,
"type": "string" "patternProperties": {
"^.+$": {
},
"additionalProperties": {
"type": "string"
}
} }
}, },
"headers": { "headers": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": false,
"type": "string" "patternProperties": {
"^.+$": {
},
"additionalProperties": {
"type": "string"
}
} }
}, },
"html": { "html": {
"type": [ "oneOf": [
"string", {
"array" "type": "array",
], "items": {
"items": { "type": "string",
"type": "string" "pattern": "^(?!\\s*$).+"
} }
},
{
"type": "string",
"pattern": "^(?!\\s*$).+"
}
]
}, },
"excludes": { "excludes": {
"type": [ "oneOf": [
"string", {
"array" "type": "array",
], "items": {
"items": { "type": "string",
"type": "string" "pattern": "^(?!\\s*$).+"
} }
},
{
"type": "string",
"pattern": "^(?!\\s*$).+"
}
]
}, },
"implies": { "implies": {
"type": [ "oneOf": [
"string", {
"array" "type": "array",
], "items": {
"items": { "type": "string",
"type": "string" "pattern": "^(?!\\s*$).+"
} }
},
{
"type": "string",
"pattern": "^(?!\\s*$).+"
}
]
}, },
"meta": { "meta": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": false,
"type": "string" "patternProperties": {
"^.+$": {
},
"additionalProperties": {
"type": "string"
}
} }
}, },
"script": { "script": {
"type": [ "oneOf": [
"string", {
"array" "type": "array",
], "items": {
"items": { "type": "string",
"type": "string" "pattern": "^(?!\\s*$).+"
} }
},
{
"type": "string",
"pattern": "^(?!\\s*$).+"
}
]
}, },
"url": { "url": {
"type": "string" "type": "string",
"pattern": "^(?!\\s*$).+"
}, },
"website": { "website": {
"type": "string", "type": "string",
"required": true "pattern": "^(?!\\s*$).+"
}, },
"icon": { "icon": {
"type": "string" "type": "string",
"pattern": "^(?!\\s*$).+"
} }
} }
} }