From 08d87573d493afde25079ba954f5b94ec6c091e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 19 Jul 2017 17:47:19 +0200 Subject: [PATCH] Make the schema more sane --- schema.json | 200 +++++++++++++++++++++++++++------------------------- 1 file changed, 103 insertions(+), 97 deletions(-) diff --git a/schema.json b/schema.json index ed7392b..5018593 100644 --- a/schema.json +++ b/schema.json @@ -1,42 +1,84 @@ { - "required": [ - "namespace", - "description", - "version", - "predicates" - ], - "properties": { - "type": { - "minItems": 1, - "items": { - "type": "string" - }, + "$schema": "http://json-schema.org/schema#", + "title": "Validator for misp-taxonomies", + "id": "https://www.github.com/MISP/misp-taxonomies/schema.json", + "defs": { + "entry": { + "type": "array", "uniqueItems": true, - "type": "array" - }, - "refs": { "items": { - "type": "string" - }, - "uniqueItems": true, - "type": "array" + "type": "object", + "additionalProperties": false, + "properties": { + "numerical_value": { + "type": "number" + }, + "expanded": { + "type": "string" + }, + "description": { + "type": "string" + }, + "value": { + "type": "string" + }, + "required": [ + "value" + ] + } + } }, "values": { - "items": { - "$ref": "#/defs/entry", - "type": "object" - }, + "type": "array", "uniqueItems": true, - "type": "array" + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "entry": { + "$ref": "#/defs/entry" + }, + "predicate": { + "type": "string" + } + }, + "required": [ + "predicate" + ] + } }, "predicates": { - "items": { - "$ref": "#/defs/predicate", - "type": "object" - }, + "type": "array", "uniqueItems": true, - "type": "array" - }, + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "numerical_value": { + "type": "number" + }, + "colour": { + "type": "string" + }, + "description": { + "type": "string" + }, + "expanded": { + "type": "string" + }, + "value": { + "type": "string" + }, + "required": [ + "value" + ] + } + } + } + }, + "type": "object", + "additionalProperties": false, + "properties": { "version": { "type": "integer" }, @@ -48,74 +90,38 @@ }, "namespace": { "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "defs": { - "required": [ - "predicate" - ], - "entry": { - "properties": { - "entry": { - "items": { - "required": [ - "value" - ], - "properties": { - "numerical_value": { - "type": "number" - }, - "expanded": { - "type": "string" - }, - "description": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object" - }, - "uniqueItems": true, - "type": "array" - }, - "predicate": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object" }, - "predicate": { - "required": [ - "value" - ], - "properties": { - "expanded": { - "type": "string" - }, - "numerical_value": { - "type": "number" - }, - "description": { - "type": "string" - }, - "colour": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object" + "type": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "org", + "user", + "attribute", + "event" + ] + } + }, + "refs": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + } + }, + "predicates": { + "$ref": "#/defs/predicates" + }, + "values": { + "$ref": "#/defs/values" } }, - "id": "https://www.github.com/MISP/misp-taxonomies/schema.json", - "title": "Validator for misp-taxonomies", - "$schema": "http://json-schema.org/schema#" + "required": [ + "namespace", + "description", + "version", + "predicates" + ] }