Skip to content

Commit

Permalink
Removed strict $schema: const, so that https also gets transformed (#187
Browse files Browse the repository at this point in the history
)

Signed-off-by: Suprith KG <suprith7kg@gmail.com>
Signed-off-by: Suprith KG <77973415+Era-cell@users.noreply.github.com>
  • Loading branch information
suprith-hub authored Apr 1, 2024
1 parent 2314e65 commit 16034fa
Show file tree
Hide file tree
Showing 15 changed files with 194 additions and 5 deletions.
3 changes: 2 additions & 1 deletion rules/jsonschema-2019-09-to-2020-12.json
Original file line number Diff line number Diff line change
Expand Up @@ -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[#]?$"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion rules/jsonschema-draft3-to-draft4.json
Original file line number Diff line number Diff line change
Expand Up @@ -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[#]?$"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion rules/jsonschema-draft4-to-draft6.json
Original file line number Diff line number Diff line change
Expand Up @@ -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[#]?$"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion rules/jsonschema-draft6-to-draft7.json
Original file line number Diff line number Diff line change
Expand Up @@ -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[#]?$"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion rules/jsonschema-draft7-to-2019-09.json
Original file line number Diff line number Diff line change
Expand Up @@ -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[#]?$"
}
}
},
Expand Down
22 changes: 22 additions & 0 deletions test/rules/jsonschema-2019-09-to-2020-12.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions test/rules/jsonschema-draft4-to-2019-09.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions test/rules/jsonschema-draft4-to-2020-12.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions test/rules/jsonschema-draft4-to-draft6.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions test/rules/jsonschema-draft4-to-draft7.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions test/rules/jsonschema-draft6-to-2019-09.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions test/rules/jsonschema-draft6-to-2020-12.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions test/rules/jsonschema-draft6-to-draft7.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down
18 changes: 18 additions & 0 deletions test/rules/jsonschema-draft7-to-2019-09.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions test/rules/jsonschema-draft7-to-2020-12.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 16034fa

Please sign in to comment.