From 1087db47f1afbdcef97c4c0847e6c971718af23b Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Thu, 8 Nov 2018 11:18:15 -0800 Subject: [PATCH 01/10] Use "uri-reference", not "url" or "uriref" There is no way to tell a validator that a schema is using draft-wright-json-schema-validation-00, which is the only draft with a "uriref" format. Validators either interpret schemas as the previous draft (fge-04), which does not have this concept at all, or the following draft (wright-01) which has "uri-reference". Since there are no options that will automatically work correctly, using the later form seems to be the best. Many validators allow registering extensions, and we can just document that we are using the wright-01+ syntax. You often need to register format handlers to get *any* format validation with many validators anyway, so this does not seem overly burdensome. --- schemas/v3.0/schema.yaml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 67bd3750d0..d8c3de8790 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -38,7 +38,7 @@ definitions: properties: $ref: type: string - format: uriref + format: uri-reference Info: type: object required: @@ -51,7 +51,7 @@ definitions: type: string termsOfService: type: string - format: uriref + format: uri-reference contact: $ref: '#/definitions/Contact' license: @@ -70,7 +70,7 @@ definitions: type: string url: type: string - format: uriref + format: uri-reference email: type: string format: email @@ -87,7 +87,7 @@ definitions: type: string url: type: string - format: uriref + format: uri-reference patternProperties: '^x-': {} additionalProperties: false @@ -347,7 +347,7 @@ definitions: type: string namespace: type: string - format: url + format: uri-reference prefix: type: string attribute: @@ -440,7 +440,7 @@ definitions: value: {} externalValue: type: string - format: uriref + format: uri-reference patternProperties: '^x-': {} additionalProperties: false @@ -707,7 +707,7 @@ definitions: type: string url: type: string - format: uriref + format: uri-reference patternProperties: '^x-': {} additionalProperties: false @@ -1326,7 +1326,7 @@ definitions: - openIdConnect openIdConnectUrl: type: string - format: url + format: uri-reference description: type: string patternProperties: @@ -1356,10 +1356,10 @@ definitions: properties: authorizationUrl: type: string - format: uriref + format: uri-reference refreshUrl: type: string - format: uriref + format: uri-reference scopes: type: object additionalProperties: @@ -1375,10 +1375,10 @@ definitions: properties: tokenUrl: type: string - format: uriref + format: uri-reference refreshUrl: type: string - format: uriref + format: uri-reference scopes: type: object additionalProperties: @@ -1394,10 +1394,10 @@ definitions: properties: tokenUrl: type: string - format: uriref + format: uri-reference refreshUrl: type: string - format: uriref + format: uri-reference scopes: type: object additionalProperties: @@ -1414,13 +1414,13 @@ definitions: properties: authorizationUrl: type: string - format: uriref + format: uri-reference tokenUrl: type: string - format: uriref + format: uri-reference refreshUrl: type: string - format: uriref + format: uri-reference scopes: type: object additionalProperties: @@ -1439,7 +1439,7 @@ definitions: properties: operationRef: type: string - format: uriref + format: uri-reference parameters: type: object additionalProperties: {} @@ -1497,4 +1497,4 @@ definitions: allowReserved: type: boolean default: false - additionalProperties: false \ No newline at end of file + additionalProperties: false From 13a4fd24971deee4024b5c4afd262473c0c9d43e Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Thu, 8 Nov 2018 11:26:05 -0800 Subject: [PATCH 02/10] Fix usage of "not" Constructs such as: type: object not: type: object will always fail, so remove the type inside the not. The "not" usage around "^x-" patterns for responses is unnecessary, as the existing patternProperties: "[1-5]..." additionalProperties: false prevents all property that do not start with 1, 2, 3, 4, or 5 from being allowed already. --- schemas/v3.0/schema.yaml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index d8c3de8790..10ad5176a2 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -666,14 +666,8 @@ definitions: oneOf: - $ref: '#/definitions/Response' - $ref: '#/definitions/Reference' - '^x-': {} minProperties: 1 additionalProperties: false - not: - type: object - patternProperties: - '^x-': {} - additionalProperties: false SecurityRequirement: @@ -1250,13 +1244,6 @@ definitions: - $ref: '#/definitions/BearerHTTPSecurityScheme' NonBearerHTTPSecurityScheme: - not: - type: object - properties: - scheme: - type: string - enum: - - bearer type: object required: - scheme @@ -1264,6 +1251,9 @@ definitions: properties: scheme: type: string + not: + enum: + - bearer description: type: string type: From 5529143ef0144235f2341303e5f853ed5c7ac9db Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Thu, 8 Nov 2018 11:35:44 -0800 Subject: [PATCH 03/10] Use patternProperties for $ref While draft-wright-json-schema-00 forbids JSON References except where a schema is expected, no validators implement this until draft-writght-json-schema-01. wright-00 schemas are in practice processed as draft-04 schemas, meaning that "$ref" is always considered a JSON Reference. Or, at least, some validators do that. We can work around this by using a pattern that only matches "$ref". There is no problem with the $ref in the "required" keyword, as only "$ref" as a property name is recognized as a reference. --- schemas/v3.0/schema.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 10ad5176a2..5963c2ca4b 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -35,8 +35,8 @@ definitions: type: object required: - $ref - properties: - $ref: + patternProperties: + '^\$ref$': type: string format: uri-reference Info: From 82ef49c0690770e36f8ceaed75b6ee73535b1bbc Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Thu, 15 Nov 2018 09:41:43 -0800 Subject: [PATCH 04/10] XML namespace must be an absolute URI --- schemas/v3.0/schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 5963c2ca4b..afe45452e3 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -347,7 +347,7 @@ definitions: type: string namespace: type: string - format: uri-reference + format: uri prefix: type: string attribute: From f71d7f825c6b50a0fc5ce2c4ba50e9673f0b8a61 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 20 Nov 2018 03:28:20 +0000 Subject: [PATCH 05/10] In Daft 5, schema.enum only SHOULD be unique, not MUST --- schemas/v3.0/schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index afe45452e3..5fc07f584f 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -252,7 +252,7 @@ definitions: type: array items: {} minItems: 1 - uniqueItems: true + uniqueItems: false type: type: string enum: From e6192597fbd72190742bc536196a437649f8d326 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 20 Nov 2018 03:29:54 +0000 Subject: [PATCH 06/10] parameters arrays MUST be unique on name & in, therefore MUST be unique across all properties --- schemas/v3.0/schema.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 5fc07f584f..52eb1a137b 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -600,6 +600,7 @@ definitions: oneOf: - $ref: '#/definitions/Parameter' - $ref: '#/definitions/Reference' + uniqueItems: true patternProperties: '^x-': {} additionalProperties: false @@ -627,6 +628,7 @@ definitions: oneOf: - $ref: '#/definitions/Parameter' - $ref: '#/definitions/Reference' + uniqueItems: true requestBody: oneOf: - $ref: '#/definitions/RequestBody' From e9de80fc38277f6710b9aa28e92f4b018bfd504e Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 20 Nov 2018 03:31:01 +0000 Subject: [PATCH 07/10] tags array MUST be unique by name, therefore MUST be unique across all properties --- schemas/v3.0/schema.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 52eb1a137b..bd54d6f773 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -23,6 +23,7 @@ properties: type: array items: $ref: '#/definitions/Tag' + uniqueItems: true paths: $ref: '#/definitions/Paths' components: From 99226cf609a3663ded8b85f3cc3e1d0ce24306b8 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 20 Nov 2018 03:45:04 +0000 Subject: [PATCH 08/10] responses object keys pattern must be anchored --- schemas/v3.0/schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index bd54d6f773..b691d9c131 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -665,7 +665,7 @@ definitions: - $ref: '#/definitions/Response' - $ref: '#/definitions/Reference' patternProperties: - '[1-5](?:\d{2}|XX)': + '^[1-5](?:\d{2}|XX)$': oneOf: - $ref: '#/definitions/Response' - $ref: '#/definitions/Reference' From 6fbc9269b75f20ecdf723b7c264e6d9178b2fbad Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 20 Nov 2018 03:47:41 +0000 Subject: [PATCH 09/10] responses object map MAY be extended with specification extensions --- schemas/v3.0/schema.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index b691d9c131..51b02f2cde 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -669,6 +669,7 @@ definitions: oneOf: - $ref: '#/definitions/Response' - $ref: '#/definitions/Reference' + '^x-': {} minProperties: 1 additionalProperties: false From 0684d656a7de8ec1e727e31fa268b7213351e090 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 20 Nov 2018 03:53:29 +0000 Subject: [PATCH 10/10] Response.headers map missing type:object --- schemas/v3.0/schema.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/schemas/v3.0/schema.yaml b/schemas/v3.0/schema.yaml index 51b02f2cde..90c72683d9 100644 --- a/schemas/v3.0/schema.yaml +++ b/schemas/v3.0/schema.yaml @@ -369,6 +369,7 @@ definitions: description: type: string headers: + type: object additionalProperties: oneOf: - $ref: '#/definitions/Header'