Skip to content

Move tests with ids in non-schemas to optional #707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 0 additions & 90 deletions tests/draft-next/anchor.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,64 +81,6 @@
}
]
},
{
"description": "$anchor inside an enum is not a real identifier",
"comment": "the implementation must not be confused by an $anchor buried in the enum",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"anchor_in_enum": {
"enum": [
{
"$anchor": "my_anchor",
"type": "null"
}
]
},
"real_identifier_in_schema": {
"$anchor": "my_anchor",
"type": "string"
},
"zzz_anchor_in_const": {
"const": {
"$anchor": "my_anchor",
"type": "null"
}
}
},
"anyOf": [
{ "$ref": "#/$defs/anchor_in_enum" },
{ "$ref": "#my_anchor" }
]
},
"tests": [
{
"description": "exact match to enum, and type matches",
"data": {
"$anchor": "my_anchor",
"type": "null"
},
"valid": true
},
{
"description": "in implementations that strip $anchor, this may match either $def",
"data": {
"type": "null"
},
"valid": false
},
{
"description": "match $ref to $anchor",
"data": "a string to match #/$defs/anchor_in_enum",
"valid": true
},
{
"description": "no match on enum or $ref to $anchor",
"data": 1,
"valid": false
}
]
},
{
"description": "same $anchor with different base uri",
"schema": {
Expand Down Expand Up @@ -175,38 +117,6 @@
}
]
},
{
"description": "non-schema object containing an $anchor property",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"const_not_anchor": {
"const": {
"$anchor": "not_a_real_anchor"
}
}
},
"if": {
"const": "skip not_a_real_anchor"
},
"then": true,
"else" : {
"$ref": "#/$defs/const_not_anchor"
}
},
"tests": [
{
"description": "skip traversing definition for a valid result",
"data": "skip not_a_real_anchor",
"valid": true
},
{
"description": "const at const_not_anchor does not match",
"data": 1,
"valid": false
}
]
},
{
"description": "invalid anchors",
"schema": {
Expand Down
83 changes: 0 additions & 83 deletions tests/draft-next/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,88 +207,5 @@
"valid": true
}
]
},
{
"description": "$id inside an enum is not a real identifier",
"comment": "the implementation must not be confused by an $id buried in the enum",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"id_in_enum": {
"enum": [
{
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
"type": "null"
}
]
},
"real_id_in_schema": {
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
"type": "string"
},
"zzz_id_in_const": {
"const": {
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
"type": "null"
}
}
},
"anyOf": [
{ "$ref": "#/$defs/id_in_enum" },
{ "$ref": "https://localhost:1234/draft-next/id/my_identifier.json" }
]
},
"tests": [
{
"description": "exact match to enum, and type matches",
"data": {
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
"type": "null"
},
"valid": true
},
{
"description": "match $ref to $id",
"data": "a string to match #/$defs/id_in_enum",
"valid": true
},
{
"description": "no match on enum or $ref to $id",
"data": 1,
"valid": false
}
]
},
{
"description": "non-schema object containing an $id property",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"const_not_id": {
"const": {
"$id": "not_a_real_id"
}
}
},
"if": {
"const": "skip not_a_real_id"
},
"then": true,
"else" : {
"$ref": "#/$defs/const_not_id"
}
},
"tests": [
{
"description": "skip traversing definition for a valid result",
"data": "skip not_a_real_id",
"valid": true
},
{
"description": "const at const_not_id does not match",
"data": 1,
"valid": false
}
]
}
]
60 changes: 60 additions & 0 deletions tests/draft-next/optional/anchor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[
{
"description": "$anchor inside an enum is not a real identifier",
"comment": "the implementation must not be confused by an $anchor buried in the enum",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"anchor_in_enum": {
"enum": [
{
"$anchor": "my_anchor",
"type": "null"
}
]
},
"real_identifier_in_schema": {
"$anchor": "my_anchor",
"type": "string"
},
"zzz_anchor_in_const": {
"const": {
"$anchor": "my_anchor",
"type": "null"
}
}
},
"anyOf": [
{ "$ref": "#/$defs/anchor_in_enum" },
{ "$ref": "#my_anchor" }
]
},
"tests": [
{
"description": "exact match to enum, and type matches",
"data": {
"$anchor": "my_anchor",
"type": "null"
},
"valid": true
},
{
"description": "in implementations that strip $anchor, this may match either $def",
"data": {
"type": "null"
},
"valid": false
},
{
"description": "match $ref to $anchor",
"data": "a string to match #/$defs/anchor_in_enum",
"valid": true
},
{
"description": "no match on enum or $ref to $anchor",
"data": 1,
"valid": false
}
]
}
]
53 changes: 53 additions & 0 deletions tests/draft-next/optional/id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[
{
"description": "$id inside an enum is not a real identifier",
"comment": "the implementation must not be confused by an $id buried in the enum",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"id_in_enum": {
"enum": [
{
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
"type": "null"
}
]
},
"real_id_in_schema": {
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
"type": "string"
},
"zzz_id_in_const": {
"const": {
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
"type": "null"
}
}
},
"anyOf": [
{ "$ref": "#/$defs/id_in_enum" },
{ "$ref": "https://localhost:1234/draft-next/id/my_identifier.json" }
]
},
"tests": [
{
"description": "exact match to enum, and type matches",
"data": {
"$id": "https://localhost:1234/draft-next/id/my_identifier.json",
"type": "null"
},
"valid": true
},
{
"description": "match $ref to $id",
"data": "a string to match #/$defs/id_in_enum",
"valid": true
},
{
"description": "no match on enum or $ref to $id",
"data": 1,
"valid": false
}
]
}
]
Loading