From 9bf4da3a7ae3de288edc3be76029b0f7618c3031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 14 Feb 2017 10:19:20 +0100 Subject: [PATCH] Add validator for galaxies --- jq_all_the_things.sh | 8 +++++++- schema.json => schema_clusters.json | 0 schema_galaxies.json | 31 +++++++++++++++++++++++++++++ validate_all.sh | 9 ++++++++- 4 files changed, 46 insertions(+), 2 deletions(-) rename schema.json => schema_clusters.json (100%) create mode 100644 schema_galaxies.json diff --git a/jq_all_the_things.sh b/jq_all_the_things.sh index 09f1f01..16e241e 100755 --- a/jq_all_the_things.sh +++ b/jq_all_the_things.sh @@ -10,4 +10,10 @@ do cat ${dir} | jq . | sponge ${dir} 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 diff --git a/schema.json b/schema_clusters.json similarity index 100% rename from schema.json rename to schema_clusters.json diff --git a/schema_galaxies.json b/schema_galaxies.json new file mode 100644 index 0000000..5f4a629 --- /dev/null +++ b/schema_galaxies.json @@ -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" + ] +} diff --git a/validate_all.sh b/validate_all.sh index 129269a..bcf0640 100755 --- a/validate_all.sh +++ b/validate_all.sh @@ -15,7 +15,14 @@ fi for dir in clusters/*.json do 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 '' done