[
	{
		"description": "root pointer ref",
		"schema": {
			"properties": {
				"foo": {
					"$ref": "#"
				}
			},
			"additionalProperties": false
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "match",
				"data": {
					"foo": false
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "recursive match",
				"data": {
					"foo": {
						"foo": false
					}
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "mismatch",
				"data": {
					"bar": false
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "recursive mismatch",
				"data": {
					"foo": {
						"bar": false
					}
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "relative pointer ref to object",
		"schema": {
			"properties": {
				"foo": {
					"type": "integer"
				},
				"bar": {
					"$ref": "#/properties/foo"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "match",
				"data": {
					"bar": 3
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "mismatch",
				"data": {
					"bar": true
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "relative pointer ref to array",
		"schema": {
			"items": [
				{
					"type": "integer"
				},
				{
					"$ref": "#/items/0"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "match array",
				"data": [
					1,
					2
				],
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "mismatch array",
				"data": [
					1,
					"foo"
				],
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "escaped pointer ref",
		"schema": {
			"definitions": {
				"tilde~field": {
					"type": "integer"
				},
				"slash/field": {
					"type": "integer"
				},
				"percent%field": {
					"type": "integer"
				}
			},
			"properties": {
				"tilde": {
					"$ref": "#/definitions/tilde~0field"
				},
				"slash": {
					"$ref": "#/definitions/slash~1field"
				},
				"percent": {
					"$ref": "#/definitions/percent%25field"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "slash invalid",
				"data": {
					"slash": "aoeu"
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "tilde invalid",
				"data": {
					"tilde": "aoeu"
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "percent invalid",
				"data": {
					"percent": "aoeu"
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "slash valid",
				"data": {
					"slash": 123
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "tilde valid",
				"data": {
					"tilde": 123
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "percent valid",
				"data": {
					"percent": 123
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "nested refs",
		"schema": {
			"definitions": {
				"a": {
					"type": "integer"
				},
				"b": {
					"$ref": "#/definitions/a"
				},
				"c": {
					"$ref": "#/definitions/b"
				}
			},
			"allOf": [
				{
					"$ref": "#/definitions/c"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "nested ref valid",
				"data": 5,
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "nested ref invalid",
				"data": "a",
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "ref overrides any sibling keywords",
		"schema": {
			"definitions": {
				"reffed": {
					"type": "array"
				}
			},
			"properties": {
				"foo": {
					"$ref": "#/definitions/reffed",
					"maxItems": 2
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "ref valid",
				"data": {
					"foo": []
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "ref valid, maxItems ignored",
				"data": {
					"foo": [
						1,
						2,
						3
					]
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "ref invalid",
				"data": {
					"foo": "string"
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "$ref prevents a sibling $id from changing the base uri",
		"schema": {
			"$id": "http://localhost:1234/sibling_id/base/",
			"definitions": {
				"foo": {
					"$id": "http://localhost:1234/sibling_id/foo.json",
					"type": "string"
				},
				"base_foo": {
					"$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json",
					"$id": "foo.json",
					"type": "number"
				}
			},
			"allOf": [
				{
					"$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not http://localhost:1234/sibling_id/foo.json",
					"$id": "http://localhost:1234/sibling_id/",
					"$ref": "foo.json"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "$ref resolves to /definitions/base_foo, data does not validate",
				"data": "a",
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "$ref resolves to /definitions/base_foo, data validates",
				"data": 1,
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "remote ref, containing refs itself",
		"schema": {
			"$ref": "http://json-schema.org/draft-07/schema#"
		},
		"skip": {
			"v3": "extract error: cannot compile resulting schema: package \"json-schema.org/draft-07/schema\" imported but not defined in :\n    generated.cue:1:8\nimport \"json-schema.org/draft-07/schema\" not found:\n    generated.cue:3:1\n",
			"v3-roundtrip": "inital extract failed"
		},
		"tests": [
			{
				"description": "remote ref valid",
				"data": {
					"minLength": 1
				},
				"valid": true,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "remote ref invalid",
				"data": {
					"minLength": -1
				},
				"valid": false,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "property named $ref that is not a reference",
		"schema": {
			"properties": {
				"$ref": {
					"type": "string"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "property named $ref valid",
				"data": {
					"$ref": "a"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "property named $ref invalid",
				"data": {
					"$ref": 2
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "property named $ref, containing an actual $ref",
		"schema": {
			"properties": {
				"$ref": {
					"$ref": "#/definitions/is-string"
				}
			},
			"definitions": {
				"is-string": {
					"type": "string"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "property named $ref valid",
				"data": {
					"$ref": "a"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "property named $ref invalid",
				"data": {
					"$ref": 2
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "$ref to boolean schema true",
		"schema": {
			"allOf": [
				{
					"$ref": "#/definitions/bool"
				}
			],
			"definitions": {
				"bool": true
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "any value is valid",
				"data": "foo",
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "$ref to boolean schema false",
		"schema": {
			"allOf": [
				{
					"$ref": "#/definitions/bool"
				}
			],
			"definitions": {
				"bool": false
			}
		},
		"skip": {
			"v3": "extract error: cannot compile resulting schema: disallowed:\n    generated.cue:4:8\n#bool: disallowed:\n    generated.cue:4:8\n",
			"v3-roundtrip": "inital extract failed"
		},
		"tests": [
			{
				"description": "any value is invalid",
				"data": "foo",
				"valid": false,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "Recursive references between schemas",
		"schema": {
			"$id": "http://localhost:1234/tree",
			"description": "tree of nodes",
			"type": "object",
			"properties": {
				"meta": {
					"type": "string"
				},
				"nodes": {
					"type": "array",
					"items": {
						"$ref": "node"
					}
				}
			},
			"required": [
				"meta",
				"nodes"
			],
			"definitions": {
				"node": {
					"$id": "http://localhost:1234/node",
					"description": "node",
					"type": "object",
					"properties": {
						"value": {
							"type": "number"
						},
						"subtree": {
							"$ref": "tree"
						}
					},
					"required": [
						"value"
					]
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "valid tree",
				"data": {
					"meta": "root",
					"nodes": [
						{
							"value": 1,
							"subtree": {
								"meta": "child",
								"nodes": [
									{
										"value": 1.1
									},
									{
										"value": 1.2
									}
								]
							}
						},
						{
							"value": 2,
							"subtree": {
								"meta": "child",
								"nodes": [
									{
										"value": 2.1
									},
									{
										"value": 2.2
									}
								]
							}
						}
					]
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "invalid tree",
				"data": {
					"meta": "root",
					"nodes": [
						{
							"value": 1,
							"subtree": {
								"meta": "child",
								"nodes": [
									{
										"value": "string is invalid"
									},
									{
										"value": 1.2
									}
								]
							}
						},
						{
							"value": 2,
							"subtree": {
								"meta": "child",
								"nodes": [
									{
										"value": 2.1
									},
									{
										"value": 2.2
									}
								]
							}
						}
					]
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "refs with quote",
		"schema": {
			"properties": {
				"foo\"bar": {
					"$ref": "#/definitions/foo%22bar"
				}
			},
			"definitions": {
				"foo\"bar": {
					"type": "number"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "object with numbers is valid",
				"data": {
					"foo\"bar": 1
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "object with strings is invalid",
				"data": {
					"foo\"bar": "1"
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "Location-independent identifier",
		"schema": {
			"allOf": [
				{
					"$ref": "#foo"
				}
			],
			"definitions": {
				"A": {
					"$id": "#foo",
					"type": "integer"
				}
			}
		},
		"skip": {
			"v3": "extract error: $id URI may not contain a fragment (and 3 more errors)",
			"v3-roundtrip": "inital extract failed"
		},
		"tests": [
			{
				"description": "match",
				"data": 1,
				"valid": true,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "mismatch",
				"data": "a",
				"valid": false,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "Reference an anchor with a non-relative URI",
		"schema": {
			"$id": "https://example.com/schema-with-anchor",
			"allOf": [
				{
					"$ref": "https://example.com/schema-with-anchor#foo"
				}
			],
			"definitions": {
				"A": {
					"$id": "#foo",
					"type": "integer"
				}
			}
		},
		"skip": {
			"v3": "extract error: $id URI may not contain a fragment (and 3 more errors)",
			"v3-roundtrip": "inital extract failed"
		},
		"tests": [
			{
				"description": "match",
				"data": 1,
				"valid": true,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "mismatch",
				"data": "a",
				"valid": false,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "Location-independent identifier with base URI change in subschema",
		"schema": {
			"$id": "http://localhost:1234/root",
			"allOf": [
				{
					"$ref": "http://localhost:1234/nested.json#foo"
				}
			],
			"definitions": {
				"A": {
					"$id": "nested.json",
					"definitions": {
						"B": {
							"$id": "#foo",
							"type": "integer"
						}
					}
				}
			}
		},
		"skip": {
			"v3": "extract error: $id URI may not contain a fragment (and 3 more errors)",
			"v3-roundtrip": "inital extract failed"
		},
		"tests": [
			{
				"description": "match",
				"data": 1,
				"valid": true,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "mismatch",
				"data": "a",
				"valid": false,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "naive replacement of $ref with its destination is not correct",
		"schema": {
			"definitions": {
				"a_string": {
					"type": "string"
				}
			},
			"enum": [
				{
					"$ref": "#/definitions/a_string"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "do not evaluate the $ref inside the enum, matching any string",
				"data": "this is a string",
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "do not evaluate the $ref inside the enum, definition exact match",
				"data": {
					"type": "string"
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "match the enum exactly",
				"data": {
					"$ref": "#/definitions/a_string"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "refs with relative uris and defs",
		"schema": {
			"$id": "http://example.com/schema-relative-uri-defs1.json",
			"properties": {
				"foo": {
					"$id": "schema-relative-uri-defs2.json",
					"definitions": {
						"inner": {
							"properties": {
								"bar": {
									"type": "string"
								}
							}
						}
					},
					"allOf": [
						{
							"$ref": "#/definitions/inner"
						}
					]
				}
			},
			"allOf": [
				{
					"$ref": "schema-relative-uri-defs2.json"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "invalid on inner field",
				"data": {
					"foo": {
						"bar": 1
					},
					"bar": "a"
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "invalid on outer field",
				"data": {
					"foo": {
						"bar": "a"
					},
					"bar": 1
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "valid on both fields",
				"data": {
					"foo": {
						"bar": "a"
					},
					"bar": "a"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "relative refs with absolute uris and defs",
		"schema": {
			"$id": "http://example.com/schema-refs-absolute-uris-defs1.json",
			"properties": {
				"foo": {
					"$id": "http://example.com/schema-refs-absolute-uris-defs2.json",
					"definitions": {
						"inner": {
							"properties": {
								"bar": {
									"type": "string"
								}
							}
						}
					},
					"allOf": [
						{
							"$ref": "#/definitions/inner"
						}
					]
				}
			},
			"allOf": [
				{
					"$ref": "schema-refs-absolute-uris-defs2.json"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "invalid on inner field",
				"data": {
					"foo": {
						"bar": 1
					},
					"bar": "a"
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "invalid on outer field",
				"data": {
					"foo": {
						"bar": "a"
					},
					"bar": 1
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "valid on both fields",
				"data": {
					"foo": {
						"bar": "a"
					},
					"bar": "a"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "$id must be resolved against nearest parent, not just immediate parent",
		"schema": {
			"$id": "http://example.com/a.json",
			"definitions": {
				"x": {
					"$id": "http://example.com/b/c.json",
					"not": {
						"definitions": {
							"y": {
								"$id": "d.json",
								"type": "number"
							}
						}
					}
				}
			},
			"allOf": [
				{
					"$ref": "http://example.com/b/d.json"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "number is valid",
				"data": 1,
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "non-number is invalid",
				"data": "a",
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "simple URN base URI with $ref via the URN",
		"schema": {
			"$comment": "URIs do not have to have HTTP(s) schemes",
			"$id": "urn:uuid:deadbeef-1234-ffff-ffff-4321feebdaed",
			"minimum": 30,
			"properties": {
				"foo": {
					"$ref": "urn:uuid:deadbeef-1234-ffff-ffff-4321feebdaed"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "valid under the URN IDed schema",
				"data": {
					"foo": 37
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "invalid under the URN IDed schema",
				"data": {
					"foo": 12
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "simple URN base URI with JSON pointer",
		"schema": {
			"$comment": "URIs do not have to have HTTP(s) schemes",
			"$id": "urn:uuid:deadbeef-1234-00ff-ff00-4321feebdaed",
			"properties": {
				"foo": {
					"$ref": "#/definitions/bar"
				}
			},
			"definitions": {
				"bar": {
					"type": "string"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "a string is valid",
				"data": {
					"foo": "bar"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "a non-string is invalid",
				"data": {
					"foo": 12
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "URN base URI with NSS",
		"schema": {
			"$comment": "RFC 8141 §2.2",
			"$id": "urn:example:1/406/47452/2",
			"properties": {
				"foo": {
					"$ref": "#/definitions/bar"
				}
			},
			"definitions": {
				"bar": {
					"type": "string"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "a string is valid",
				"data": {
					"foo": "bar"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "a non-string is invalid",
				"data": {
					"foo": 12
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "URN base URI with r-component",
		"schema": {
			"$comment": "RFC 8141 §2.3.1",
			"$id": "urn:example:foo-bar-baz-qux?+CCResolve:cc=uk",
			"properties": {
				"foo": {
					"$ref": "#/definitions/bar"
				}
			},
			"definitions": {
				"bar": {
					"type": "string"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "a string is valid",
				"data": {
					"foo": "bar"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "a non-string is invalid",
				"data": {
					"foo": 12
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "URN base URI with q-component",
		"schema": {
			"$comment": "RFC 8141 §2.3.2",
			"$id": "urn:example:weather?=op=map\u0026lat=39.56\u0026lon=-104.85\u0026datetime=1969-07-21T02:56:15Z",
			"properties": {
				"foo": {
					"$ref": "#/definitions/bar"
				}
			},
			"definitions": {
				"bar": {
					"type": "string"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "a string is valid",
				"data": {
					"foo": "bar"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "a non-string is invalid",
				"data": {
					"foo": 12
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "URN base URI with URN and JSON pointer ref",
		"schema": {
			"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
			"properties": {
				"foo": {
					"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#/definitions/bar"
				}
			},
			"definitions": {
				"bar": {
					"type": "string"
				}
			}
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "a string is valid",
				"data": {
					"foo": "bar"
				},
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "a non-string is invalid",
				"data": {
					"foo": 12
				},
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "URN base URI with URN and anchor ref",
		"schema": {
			"$id": "urn:uuid:deadbeef-1234-ff00-00ff-4321feebdaed",
			"properties": {
				"foo": {
					"$ref": "urn:uuid:deadbeef-1234-ff00-00ff-4321feebdaed#something"
				}
			},
			"definitions": {
				"bar": {
					"$id": "#something",
					"type": "string"
				}
			}
		},
		"skip": {
			"v3": "extract error: cannot determine CUE location for JSON Schema location id=urn:uuid:deadbeef-1234-ff00-00ff-4321feebdaed#something: anchors (something) not supported (and 3 more errors)",
			"v3-roundtrip": "inital extract failed"
		},
		"tests": [
			{
				"description": "a string is valid",
				"data": {
					"foo": "bar"
				},
				"valid": true,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "a non-string is invalid",
				"data": {
					"foo": 12
				},
				"valid": false,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "ref to if",
		"schema": {
			"allOf": [
				{
					"$ref": "http://example.com/ref/if"
				},
				{
					"if": {
						"$id": "http://example.com/ref/if",
						"type": "integer"
					}
				}
			]
		},
		"skip": {
			"v3": "extract error: cannot compile resulting schema: package \"example.com/ref/if\" imported but not defined in :\n    generated.cue:1:8\nimport \"example.com/ref/if\" not found:\n    generated.cue:3:1\n",
			"v3-roundtrip": "inital extract failed"
		},
		"tests": [
			{
				"description": "a non-integer is invalid due to the $ref",
				"data": "foo",
				"valid": false,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "an integer is valid",
				"data": 12,
				"valid": true,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "ref to then",
		"schema": {
			"allOf": [
				{
					"$ref": "http://example.com/ref/then"
				},
				{
					"then": {
						"$id": "http://example.com/ref/then",
						"type": "integer"
					}
				}
			]
		},
		"skip": {
			"v3": "extract error: cannot compile resulting schema: package \"example.com/ref/then\" imported but not defined in :\n    generated.cue:1:8\nimport \"example.com/ref/then\" not found:\n    generated.cue:3:1\n",
			"v3-roundtrip": "inital extract failed"
		},
		"tests": [
			{
				"description": "a non-integer is invalid due to the $ref",
				"data": "foo",
				"valid": false,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "an integer is valid",
				"data": 12,
				"valid": true,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "ref to else",
		"schema": {
			"allOf": [
				{
					"$ref": "http://example.com/ref/else"
				},
				{
					"else": {
						"$id": "http://example.com/ref/else",
						"type": "integer"
					}
				}
			]
		},
		"skip": {
			"v3": "extract error: cannot compile resulting schema: package \"example.com/ref/else\" imported but not defined in :\n    generated.cue:1:8\nimport \"example.com/ref/else\" not found:\n    generated.cue:3:1\n",
			"v3-roundtrip": "inital extract failed"
		},
		"tests": [
			{
				"description": "a non-integer is invalid due to the $ref",
				"data": "foo",
				"valid": false,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "an integer is valid",
				"data": 12,
				"valid": true,
				"skip": {
					"v3": "could not extract schema",
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "ref with absolute-path-reference",
		"schema": {
			"$id": "http://example.com/ref/absref.json",
			"definitions": {
				"a": {
					"$id": "http://example.com/ref/absref/foobar.json",
					"type": "number"
				},
				"b": {
					"$id": "http://example.com/absref/foobar.json",
					"type": "string"
				}
			},
			"allOf": [
				{
					"$ref": "/absref/foobar.json"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "a string is valid",
				"data": "foo",
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "an integer is invalid",
				"data": 12,
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "$id with file URI still resolves pointers - *nix",
		"schema": {
			"$id": "file:///folder/file.json",
			"definitions": {
				"foo": {
					"type": "number"
				}
			},
			"allOf": [
				{
					"$ref": "#/definitions/foo"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "number is valid",
				"data": 1,
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "non-number is invalid",
				"data": "a",
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "$id with file URI still resolves pointers - windows",
		"schema": {
			"$id": "file:///c:/folder/file.json",
			"definitions": {
				"foo": {
					"type": "number"
				}
			},
			"allOf": [
				{
					"$ref": "#/definitions/foo"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "number is valid",
				"data": 1,
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "non-number is invalid",
				"data": "a",
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	},
	{
		"description": "empty tokens in $ref json-pointer",
		"schema": {
			"definitions": {
				"": {
					"definitions": {
						"": {
							"type": "number"
						}
					}
				}
			},
			"allOf": [
				{
					"$ref": "#/definitions//definitions/"
				}
			]
		},
		"skip": {
			"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema"
		},
		"tests": [
			{
				"description": "number is valid",
				"data": 1,
				"valid": true,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			},
			{
				"description": "non-number is invalid",
				"data": "a",
				"valid": false,
				"skip": {
					"v3-roundtrip": "could not extract schema"
				}
			}
		]
	}
]
