diff --git a/rules/jsonschema-2019-09-to-2020-12.json b/rules/jsonschema-2019-09-to-2020-12.json index 7e94865..a7c85b7 100644 --- a/rules/jsonschema-2019-09-to-2020-12.json +++ b/rules/jsonschema-2019-09-to-2020-12.json @@ -10,7 +10,8 @@ "required": [ "$schema" ], "properties": { "$schema": { - "const": "https://json-schema.org/draft/2019-09/schema" + "type": "string", + "pattern": "^http[s]?://json-schema.org/draft/2019-09/schema[#]?$" } } }, diff --git a/rules/jsonschema-draft3-to-draft4.json b/rules/jsonschema-draft3-to-draft4.json index 281247e..615c298 100644 --- a/rules/jsonschema-draft3-to-draft4.json +++ b/rules/jsonschema-draft3-to-draft4.json @@ -10,7 +10,8 @@ "required": [ "$schema" ], "properties": { "$schema": { - "const": "http://json-schema.org/draft-03/schema#" + "type": "string", + "pattern": "^http[s]?://json-schema.org/draft-03/schema[#]?$" } } }, diff --git a/rules/jsonschema-draft4-to-draft6.json b/rules/jsonschema-draft4-to-draft6.json index 9f76891..28ce4f5 100644 --- a/rules/jsonschema-draft4-to-draft6.json +++ b/rules/jsonschema-draft4-to-draft6.json @@ -10,7 +10,8 @@ "required": [ "$schema" ], "properties": { "$schema": { - "const": "http://json-schema.org/draft-04/schema#" + "type": "string", + "pattern": "^http[s]?://json-schema.org/draft-04/schema[#]?$" } } }, diff --git a/rules/jsonschema-draft6-to-draft7.json b/rules/jsonschema-draft6-to-draft7.json index 63d7fd8..e7e1a4c 100644 --- a/rules/jsonschema-draft6-to-draft7.json +++ b/rules/jsonschema-draft6-to-draft7.json @@ -10,7 +10,8 @@ "required": [ "$schema" ], "properties": { "$schema": { - "const": "http://json-schema.org/draft-06/schema#" + "type": "string", + "pattern": "^http[s]?://json-schema.org/draft-06/schema[#]?$" } } }, diff --git a/rules/jsonschema-draft7-to-2019-09.json b/rules/jsonschema-draft7-to-2019-09.json index 81f7bd9..2a8d7f2 100644 --- a/rules/jsonschema-draft7-to-2019-09.json +++ b/rules/jsonschema-draft7-to-2019-09.json @@ -10,7 +10,8 @@ "required": [ "$schema" ], "properties": { "$schema": { - "const": "http://json-schema.org/draft-07/schema#" + "type": "string", + "pattern": "^http[s]?://json-schema.org/draft-07/schema[#]?$" } } }, diff --git a/test/rules/jsonschema-2019-09-to-2020-12.json b/test/rules/jsonschema-2019-09-to-2020-12.json index 6c2b0d3..9c0d65b 100644 --- a/test/rules/jsonschema-2019-09-to-2020-12.json +++ b/test/rules/jsonschema-2019-09-to-2020-12.json @@ -10,6 +10,28 @@ "type": "object" } }, + { + "name": "2019-09 official $schema to 2020-12 with http scheme", + "schema": { + "$schema": "http://json-schema.org/draft/2019-09/schema", + "type": "object" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object" + } + }, + { + "name": "2019-09 official $schema to 2020-12 with an empty fragment", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema#", + "type": "object" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object" + } + }, { "name": "items array to prefixItems", "schema": { diff --git a/test/rules/jsonschema-draft4-to-2019-09.json b/test/rules/jsonschema-draft4-to-2019-09.json index 086f972..f5630fc 100644 --- a/test/rules/jsonschema-draft4-to-2019-09.json +++ b/test/rules/jsonschema-draft4-to-2019-09.json @@ -8,6 +8,24 @@ "$schema": "https://json-schema.org/draft/2019-09/schema" } }, + { + "name": "draft4 $schema with https scheme", + "schema": { + "$schema": "https://json-schema.org/draft-04/schema#" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2019-09/schema" + } + }, + { + "name": "draft4 $schema without an empty fragment", + "schema": { + "$schema": "http://json-schema.org/draft-04/schema" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2019-09/schema" + } + }, { "name": "draft4 id to $id", "schema": { diff --git a/test/rules/jsonschema-draft4-to-2020-12.json b/test/rules/jsonschema-draft4-to-2020-12.json index a2af82a..8c73dc6 100644 --- a/test/rules/jsonschema-draft4-to-2020-12.json +++ b/test/rules/jsonschema-draft4-to-2020-12.json @@ -8,6 +8,24 @@ "$schema": "https://json-schema.org/draft/2020-12/schema" } }, + { + "name": "draft4 $schema with https scheme", + "schema": { + "$schema": "http://json-schema.org/draft-04/schema#" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2020-12/schema" + } + }, + { + "name": "draft4 $schema without an empty fragment", + "schema": { + "$schema": "http://json-schema.org/draft-04/schema" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2020-12/schema" + } + }, { "name": "draft4 id to $id", "schema": { diff --git a/test/rules/jsonschema-draft4-to-draft6.json b/test/rules/jsonschema-draft4-to-draft6.json index 2dbf04c..d387929 100644 --- a/test/rules/jsonschema-draft4-to-draft6.json +++ b/test/rules/jsonschema-draft4-to-draft6.json @@ -8,6 +8,24 @@ "$schema": "http://json-schema.org/draft-06/schema#" } }, + { + "name": "draft4 $schema with https scheme", + "schema": { + "$schema": "http://json-schema.org/draft-04/schema#" + }, + "expected": { + "$schema": "http://json-schema.org/draft-06/schema#" + } + }, + { + "name": "draft4 $schema without an empty fragment", + "schema": { + "$schema": "http://json-schema.org/draft-04/schema" + }, + "expected": { + "$schema": "http://json-schema.org/draft-06/schema#" + } + }, { "name": "draft4 id to $id", "schema": { diff --git a/test/rules/jsonschema-draft4-to-draft7.json b/test/rules/jsonschema-draft4-to-draft7.json index cca8d1b..6b7ad36 100644 --- a/test/rules/jsonschema-draft4-to-draft7.json +++ b/test/rules/jsonschema-draft4-to-draft7.json @@ -8,6 +8,24 @@ "$schema": "http://json-schema.org/draft-07/schema#" } }, + { + "name": "draft4 $schema with https scheme", + "schema": { + "$schema": "http://json-schema.org/draft-04/schema#" + }, + "expected": { + "$schema": "http://json-schema.org/draft-07/schema#" + } + }, + { + "name": "draft4 $schema without an empty fragment", + "schema": { + "$schema": "http://json-schema.org/draft-04/schema" + }, + "expected": { + "$schema": "http://json-schema.org/draft-07/schema#" + } + }, { "name": "draft4 id to $id", "schema": { diff --git a/test/rules/jsonschema-draft6-to-2019-09.json b/test/rules/jsonschema-draft6-to-2019-09.json index 205294b..e75c8be 100644 --- a/test/rules/jsonschema-draft6-to-2019-09.json +++ b/test/rules/jsonschema-draft6-to-2019-09.json @@ -8,6 +8,24 @@ "$schema": "https://json-schema.org/draft/2019-09/schema" } }, + { + "name": "draft6 $schema witgh https scheme", + "schema": { + "$schema": "https://json-schema.org/draft-06/schema#" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2019-09/schema" + } + }, + { + "name": "draft6 $schema without an empty fragment", + "schema": { + "$schema": "http://json-schema.org/draft-06/schema" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2019-09/schema" + } + }, { "name": "draft6 $id with # to $anchor", "schema": { diff --git a/test/rules/jsonschema-draft6-to-2020-12.json b/test/rules/jsonschema-draft6-to-2020-12.json index 6226beb..bfa8bfc 100644 --- a/test/rules/jsonschema-draft6-to-2020-12.json +++ b/test/rules/jsonschema-draft6-to-2020-12.json @@ -8,6 +8,24 @@ "$schema": "https://json-schema.org/draft/2020-12/schema" } }, + { + "name": "draft6 $schema with https scheme", + "schema": { + "$schema": "https://json-schema.org/draft-06/schema#" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2020-12/schema" + } + }, + { + "name": "draft6 $schema without an empty fragment", + "schema": { + "$schema": "http://json-schema.org/draft-06/schema" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2020-12/schema" + } + }, { "name": "draft6 $id with # to $anchor", "schema": { diff --git a/test/rules/jsonschema-draft6-to-draft7.json b/test/rules/jsonschema-draft6-to-draft7.json index 5ecde0b..3ac517d 100644 --- a/test/rules/jsonschema-draft6-to-draft7.json +++ b/test/rules/jsonschema-draft6-to-draft7.json @@ -8,6 +8,24 @@ "$schema": "http://json-schema.org/draft-07/schema#" } }, + { + "name": "draft6 $schema wituh https scheme", + "schema": { + "$schema": "http://json-schema.org/draft-06/schema#" + }, + "expected": { + "$schema": "http://json-schema.org/draft-07/schema#" + } + }, + { + "name": "draft6 $schema without an empty fragment", + "schema": { + "$schema": "http://json-schema.org/draft-06/schema" + }, + "expected": { + "$schema": "http://json-schema.org/draft-07/schema#" + } + }, { "name": "true no metaschema", "schema": {}, diff --git a/test/rules/jsonschema-draft7-to-2019-09.json b/test/rules/jsonschema-draft7-to-2019-09.json index d63e87b..b1c1d02 100644 --- a/test/rules/jsonschema-draft7-to-2019-09.json +++ b/test/rules/jsonschema-draft7-to-2019-09.json @@ -8,6 +8,24 @@ "$schema": "https://json-schema.org/draft/2019-09/schema" } }, + { + "name": "draft7 $schema with https scheme", + "schema": { + "$schema": "https://json-schema.org/draft-07/schema#" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2019-09/schema" + } + }, + { + "name": "draft7 $schema without an empty fragment", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2019-09/schema" + } + }, { "name": "draft7 $id with # to $anchor", "schema": { diff --git a/test/rules/jsonschema-draft7-to-2020-12.json b/test/rules/jsonschema-draft7-to-2020-12.json index 85e6206..8b49bf8 100644 --- a/test/rules/jsonschema-draft7-to-2020-12.json +++ b/test/rules/jsonschema-draft7-to-2020-12.json @@ -8,6 +8,24 @@ "$schema": "https://json-schema.org/draft/2020-12/schema" } }, + { + "name": "draft7 $schema with https scheme", + "schema": { + "$schema": "https://json-schema.org/draft-07/schema#" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2020-12/schema" + } + }, + { + "name": "draft7 $schema without an empty fragment", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema" + }, + "expected": { + "$schema": "https://json-schema.org/draft/2020-12/schema" + } + }, { "name": "draft7 $id with # to $anchor", "schema": {