b/163145737 Schema for x-security-type-definitions should be array of objects Change-Id: I73d2f9252b76e077a876c21f1912f5d1f7fdfd15
diff --git a/oas-core/src/main/resources/SecurityDefinitionsSchema.json b/oas-core/src/main/resources/SecurityDefinitionsSchema.json index 06eb2fb..dcb0888 100644 --- a/oas-core/src/main/resources/SecurityDefinitionsSchema.json +++ b/oas-core/src/main/resources/SecurityDefinitionsSchema.json
@@ -1,78 +1,134 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Security definitions schema", + "$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" - } + "type": { + "type": "string" + }, + "inherits-from": { + "type": "array", + "items": { + "type": "string" } + } }, - "required": ["type"], - "additionalProperties": false, - "tests": [ + "required": [ + "type" + ], + "additionalProperties": false + }, + "tests": [ + { + "id": "VALID_1", + "description": "type and inherits-from", + "data": [ { - "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": "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 + "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 + } + ] } \ No newline at end of file