| { |
| "$schema": "http://json-schema.org/draft-04/schema#", |
| "title": "Security definitions schema", |
| "type": "array", |
| "items": { |
| "type": "object", |
| "properties": { |
| "type": { |
| "type": "string" |
| }, |
| "inherits-from": { |
| "type": "array", |
| "items": { |
| "type": "string" |
| } |
| } |
| }, |
| "required": [ |
| "type" |
| ], |
| "additionalProperties": false |
| }, |
| "tests": [ |
| { |
| "id": "VALID_1", |
| "description": "type and inherits-from", |
| "data": [ |
| { |
| "type": "customType", |
| "inherits-from": [ |
| "string1", |
| "string2" |
| ] |
| } |
| ], |
| "valid": true |
| }, |
| { |
| "id": "VALID_2", |
| "description": "only type", |
| "data": [ |
| { |
| "type": "customType" |
| } |
| ], |
| "valid": true |
| }, |
| { |
| "id": "VALID_3", |
| "description": "type and empty inherits-from", |
| "data": [ |
| { |
| "type": "pii", |
| "inherits-from": [] |
| } |
| ], |
| "valid": true |
| }, |
| { |
| "id": "VALID_4", |
| "description": "array with multiple definitions", |
| "data": [ |
| { |
| "type": "pii", |
| "inherits-from": [ |
| "ns" |
| ] |
| }, |
| { |
| "type": "spii", |
| "inherits-from": [ |
| "pii" |
| ] |
| } |
| ], |
| "valid": true |
| }, |
| { |
| "id": "VALID_5", |
| "description": "Empty array.", |
| "data": [], |
| "valid": true |
| }, |
| { |
| "id": "INVALID_1", |
| "description": "type not of string type", |
| "data": { |
| "type": 1 |
| }, |
| "valid": false |
| }, |
| { |
| "id": "INVALID_2", |
| "description": "inherits-from not of list type", |
| "data": [ |
| { |
| "type": "customType1", |
| "inherits-from": "customType2" |
| } |
| ], |
| "valid": false |
| }, |
| { |
| "id": "INVALID_3", |
| "description": "Required field 'type' not given", |
| "data": [ |
| {} |
| ], |
| "valid": false |
| }, |
| { |
| "id": "INVALID_4", |
| "description": "Additional field present", |
| "data": [ |
| { |
| "type": "customType", |
| "customField": "customString" |
| } |
| ], |
| "valid": false |
| }, |
| { |
| "id": "INVALID_5", |
| "description": "Object passed directly. Array expected.", |
| "data": { |
| "type": "pii", |
| "inherits-from": [ |
| "ns" |
| ] |
| }, |
| "valid": false |
| } |
| ] |
| } |