Add schema for relationships

pull/26/merge
Raphaël Vinot 2017-08-11 12:19:52 +02:00
parent ba3c888af8
commit dc1dce796e
4 changed files with 68 additions and 2 deletions

View File

@ -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

61
schema_relationships.json Normal file
View File

@ -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"
]
}

View File

@ -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