Add validator for galaxies

pull/33/head
Raphaël Vinot 2017-02-14 10:19:20 +01:00
parent 910398fe76
commit 9bf4da3a7a
4 changed files with 46 additions and 2 deletions

View File

@ -10,4 +10,10 @@ do
cat ${dir} | jq . | sponge ${dir} cat ${dir} | jq . | sponge ${dir}
done done
cat schema.json | jq . | sponge schema.json for dir in galaxies/*.json
do
cat ${dir} | jq . | sponge ${dir}
done
cat schema_clusters.json | jq . | sponge schema_clusters.json
cat schema_galaxies.json | jq . | sponge schema_galaxies.json

31
schema_galaxies.json Normal file
View File

@ -0,0 +1,31 @@
{
"$schema": "http://json-schema.org/schema#",
"title": "Validator for misp-galaxies",
"id": "https://www.github.com/MISP/misp-galaxies/schema.json",
"type": "object",
"additionalProperties": false,
"properties": {
"description": {
"type": "string"
},
"type": {
"type": "string"
},
"version": {
"type": "integer"
},
"name": {
"type": "string"
},
"uuid": {
"type": "string"
}
},
"required": [
"description",
"type",
"version",
"name",
"uuid"
]
}

View File

@ -15,7 +15,14 @@ fi
for dir in clusters/*.json for dir in clusters/*.json
do do
echo -n "${dir}: " echo -n "${dir}: "
jsonschema -i ${dir} schema.json jsonschema -i ${dir} schema_clusters.json
echo ''
done
for dir in galaxies/*.json
do
echo -n "${dir}: "
jsonschema -i ${dir} schema_galaxies.json
echo '' echo ''
done done