diff --git a/jq_all_the_things.sh b/jq_all_the_things.sh index e10e2d7..78d58b9 100755 --- a/jq_all_the_things.sh +++ b/jq_all_the_things.sh @@ -10,4 +10,7 @@ do cat ${dir} | jq . | sponge ${dir} done -cat schema.json | jq . | sponge schema.json +cat relationships/definition.json | jq . | sponge relationships/definition.json + +cat schema_objects.json | jq . | sponge schema_objects.json +cat schema_relationships.json | jq . | sponge schema_relationships.json diff --git a/schema.json b/schema_objects.json similarity index 100% rename from schema.json rename to schema_objects.json diff --git a/schema_relationships.json b/schema_relationships.json new file mode 100644 index 0000000..22bb0fd --- /dev/null +++ b/schema_relationships.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/schema#", + "title": "Validator for misp-objects", + "id": "https://www.github.com/MISP/misp-objects/schema.json", + "defs": { + "value": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "format": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "description", + "format" + ] + } + }, + "type": "object", + "additionalProperties": false, + "properties": { + "version": { + "type": "integer" + }, + "values": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/defs/value" + } + }, + "description": { + "type": "string" + }, + "uuid": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "version", + "values", + "description", + "uuid", + "name" + ] +} diff --git a/validate_all.sh b/validate_all.sh index 1a19b51..f1fcb4f 100755 --- a/validate_all.sh +++ b/validate_all.sh @@ -15,8 +15,10 @@ fi for dir in objects/*/definition.json do echo -n "${dir}: " - jsonschema -i ${dir} schema.json + jsonschema -i ${dir} schema_objects.json echo '' done +jsonschema -i relationships/definition.json schema_relationships.json + ./unique_uuid.py