fix: Force non-empty strings and arrays

pull/125/head
Raphaël Vinot 2018-10-31 09:20:44 +01:00
parent d1ff36cb1c
commit 8c04fe842c
1 changed files with 22 additions and 13 deletions

View File

@ -3,8 +3,13 @@
"title": "Validator for misp-taxonomies", "title": "Validator for misp-taxonomies",
"id": "https://www.github.com/MISP/misp-taxonomies/schema.json", "id": "https://www.github.com/MISP/misp-taxonomies/schema.json",
"defs": { "defs": {
"non-empty-string": {
"type": "string",
"minLength": 1
},
"entry": { "entry": {
"type": "array", "type": "array",
"minItems": 1,
"uniqueItems": true, "uniqueItems": true,
"items": { "items": {
"type": "object", "type": "object",
@ -14,16 +19,16 @@
"type": "number" "type": "number"
}, },
"expanded": { "expanded": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"description": { "description": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"colour": { "colour": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"value": { "value": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"required": [ "required": [
"value" "value"
@ -33,6 +38,7 @@
}, },
"values": { "values": {
"type": "array", "type": "array",
"minItems": 1,
"uniqueItems": true, "uniqueItems": true,
"items": { "items": {
"type": "object", "type": "object",
@ -42,7 +48,7 @@
"$ref": "#/defs/entry" "$ref": "#/defs/entry"
}, },
"predicate": { "predicate": {
"type": "string" "$ref": "#/defs/non-empty-string"
} }
}, },
"required": [ "required": [
@ -52,6 +58,7 @@
}, },
"predicates": { "predicates": {
"type": "array", "type": "array",
"minItems": 1,
"uniqueItems": true, "uniqueItems": true,
"items": { "items": {
"type": "object", "type": "object",
@ -61,16 +68,16 @@
"type": "number" "type": "number"
}, },
"colour": { "colour": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"description": { "description": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"expanded": { "expanded": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"value": { "value": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"exclusive": { "exclusive": {
"type": "boolean" "type": "boolean"
@ -89,19 +96,20 @@
"type": "integer" "type": "integer"
}, },
"description": { "description": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"expanded": { "expanded": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"namespace": { "namespace": {
"type": "string" "$ref": "#/defs/non-empty-string"
}, },
"exclusive": { "exclusive": {
"type": "boolean" "type": "boolean"
}, },
"type": { "type": {
"type": "array", "type": "array",
"minItems": 1,
"uniqueItems": true, "uniqueItems": true,
"items": { "items": {
"type": "string", "type": "string",
@ -115,9 +123,10 @@
}, },
"refs": { "refs": {
"type": "array", "type": "array",
"minItems": 1,
"uniqueItems": true, "uniqueItems": true,
"items": { "items": {
"type": "string" "$ref": "#/defs/non-empty-string"
} }
}, },
"predicates": { "predicates": {