Skip to content

Instantly share code, notes, and snippets.

@jviotti
Created August 29, 2025 20:06
Show Gist options
  • Select an option

  • Save jviotti/c92af7993bbd07bb55b11a79180c2929 to your computer and use it in GitHub Desktop.

Select an option

Save jviotti/c92af7993bbd07bb55b11a79180c2929 to your computer and use it in GitHub Desktop.
Dynamic Ref Default Bug
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "file:///Users/jviotti/Desktop/schema.json",
"$ref": "https://json-schema.org/draft/2020-12/links#/properties/targetSchema",
"$defs": {
"https://json-schema.org/draft/2020-12/hyper-schema": {
"$schema": "https://json-schema.org/draft/2020-12/hyper-schema",
"$id": "https://json-schema.org/draft/2020-12/hyper-schema",
"$vocabulary": {
"https://json-schema.org/draft/2019-09/vocab/hyper-schema": true,
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/content": true,
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
"https://json-schema.org/draft/2020-12/vocab/validation": true
},
"$dynamicAnchor": "meta",
"title": "JSON Hyper-Schema",
"allOf": [
{
"$ref": "https://json-schema.org/draft/2020-12/schema"
},
{
"$ref": "https://json-schema.org/draft/2020-12/meta/hyper-schema"
}
],
"links": [
{
"href": "{+%24id}",
"rel": "self"
}
]
},
"https://json-schema.org/draft/2020-12/meta/applicator": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/meta/applicator",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/applicator": true
},
"$dynamicAnchor": "meta",
"title": "Applicator vocabulary meta-schema",
"type": [ "object", "boolean" ],
"properties": {
"allOf": {
"$ref": "#/$defs/schemaArray"
},
"anyOf": {
"$ref": "#/$defs/schemaArray"
},
"oneOf": {
"$ref": "#/$defs/schemaArray"
},
"not": {
"$dynamicRef": "#meta"
},
"if": {
"$dynamicRef": "#meta"
},
"then": {
"$dynamicRef": "#meta"
},
"else": {
"$dynamicRef": "#meta"
},
"contains": {
"$dynamicRef": "#meta"
},
"prefixItems": {
"$ref": "#/$defs/schemaArray"
},
"items": {
"$dynamicRef": "#meta"
},
"propertyNames": {
"$dynamicRef": "#meta"
},
"properties": {
"default": {},
"type": "object",
"additionalProperties": {
"$dynamicRef": "#meta"
}
},
"patternProperties": {
"default": {},
"type": "object",
"propertyNames": {
"format": "regex"
},
"additionalProperties": {
"$dynamicRef": "#meta"
}
},
"additionalProperties": {
"$dynamicRef": "#meta"
},
"dependentSchemas": {
"default": {},
"type": "object",
"additionalProperties": {
"$dynamicRef": "#meta"
}
}
},
"$defs": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": {
"$dynamicRef": "#meta"
}
}
}
},
"https://json-schema.org/draft/2020-12/meta/content": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/meta/content",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/content": true
},
"$dynamicAnchor": "meta",
"title": "Content vocabulary meta-schema",
"type": [ "object", "boolean" ],
"properties": {
"contentEncoding": {
"type": "string"
},
"contentMediaType": {
"type": "string"
},
"contentSchema": {
"$dynamicRef": "#meta"
}
}
},
"https://json-schema.org/draft/2020-12/meta/core": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/meta/core",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/core": true
},
"$dynamicAnchor": "meta",
"title": "Core vocabulary meta-schema",
"type": [ "object", "boolean" ],
"properties": {
"$schema": {
"$ref": "#/$defs/uriString"
},
"$id": {
"$comment": "Non-empty fragments not allowed.",
"$ref": "#/$defs/uriReferenceString",
"pattern": "^[^#]*#?$"
},
"$vocabulary": {
"type": "object",
"propertyNames": {
"$ref": "#/$defs/uriString"
},
"additionalProperties": {
"type": "boolean"
}
},
"$anchor": {
"$ref": "#/$defs/anchorString"
},
"$dynamicAnchor": {
"$ref": "#/$defs/anchorString"
},
"$comment": {
"type": "string"
},
"$ref": {
"$ref": "#/$defs/uriReferenceString"
},
"$dynamicRef": {
"$ref": "#/$defs/uriReferenceString"
},
"$defs": {
"type": "object",
"additionalProperties": {
"$dynamicRef": "#meta"
}
}
},
"$defs": {
"anchorString": {
"type": "string",
"pattern": "^[A-Za-z_][-A-Za-z0-9._]*$"
},
"uriReferenceString": {
"type": "string",
"format": "uri-reference"
},
"uriString": {
"type": "string",
"format": "uri"
}
}
},
"https://json-schema.org/draft/2020-12/meta/format-annotation": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/meta/format-annotation",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true
},
"$dynamicAnchor": "meta",
"title": "Format vocabulary meta-schema for annotation results",
"type": [ "object", "boolean" ],
"properties": {
"format": {
"type": "string"
}
}
},
"https://json-schema.org/draft/2020-12/meta/hyper-schema": {
"$schema": "https://json-schema.org/draft/2020-12/hyper-schema",
"$id": "https://json-schema.org/draft/2020-12/meta/hyper-schema",
"$vocabulary": {
"https://json-schema.org/draft/2019-09/vocab/hyper-schema": true
},
"$dynamicAnchor": "meta",
"title": "JSON Hyper-Schema Vocabulary Schema",
"type": [ "object", "boolean" ],
"properties": {
"base": {
"type": "string",
"format": "uri-template"
},
"links": {
"type": "array",
"items": {
"$ref": "https://json-schema.org/draft/2020-12/links"
}
}
},
"links": [
{
"href": "{+%24id}",
"rel": "self"
}
]
},
"https://json-schema.org/draft/2020-12/meta/meta-data": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/meta/meta-data",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/meta-data": true
},
"$dynamicAnchor": "meta",
"title": "Meta-data vocabulary meta-schema",
"type": [ "object", "boolean" ],
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"examples": {
"type": "array",
"items": true
},
"deprecated": {
"default": false,
"type": "boolean"
},
"readOnly": {
"default": false,
"type": "boolean"
},
"writeOnly": {
"default": false,
"type": "boolean"
},
"default": true
}
},
"https://json-schema.org/draft/2020-12/meta/unevaluated": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/meta/unevaluated",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true
},
"$dynamicAnchor": "meta",
"title": "Unevaluated applicator vocabulary meta-schema",
"type": [ "object", "boolean" ],
"properties": {
"unevaluatedItems": {
"$dynamicRef": "#meta"
},
"unevaluatedProperties": {
"$dynamicRef": "#meta"
}
}
},
"https://json-schema.org/draft/2020-12/meta/validation": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/meta/validation",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/validation": true
},
"$dynamicAnchor": "meta",
"title": "Validation vocabulary meta-schema",
"type": [ "object", "boolean" ],
"properties": {
"type": {
"anyOf": [
{
"$ref": "#/$defs/simpleTypes"
},
{
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"$ref": "#/$defs/simpleTypes"
}
}
]
},
"const": true,
"enum": {
"type": "array",
"items": true
},
"exclusiveMaximum": {
"type": "number"
},
"maximum": {
"type": "number"
},
"exclusiveMinimum": {
"type": "number"
},
"minimum": {
"type": "number"
},
"multipleOf": {
"type": "number",
"exclusiveMinimum": 0
},
"pattern": {
"type": "string",
"format": "regex"
},
"maxLength": {
"$ref": "#/$defs/nonNegativeInteger"
},
"minLength": {
"$ref": "#/$defs/nonNegativeIntegerDefault0"
},
"maxItems": {
"$ref": "#/$defs/nonNegativeInteger"
},
"minItems": {
"$ref": "#/$defs/nonNegativeIntegerDefault0"
},
"uniqueItems": {
"default": false,
"type": "boolean"
},
"maxContains": {
"$ref": "#/$defs/nonNegativeInteger"
},
"minContains": {
"default": 1,
"$ref": "#/$defs/nonNegativeInteger"
},
"required": {
"$ref": "#/$defs/stringArray"
},
"maxProperties": {
"$ref": "#/$defs/nonNegativeInteger"
},
"minProperties": {
"$ref": "#/$defs/nonNegativeIntegerDefault0"
},
"dependentRequired": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/stringArray"
}
}
},
"$defs": {
"nonNegativeInteger": {
"type": "integer",
"minimum": 0
},
"nonNegativeIntegerDefault0": {
"default": 0,
"$ref": "#/$defs/nonNegativeInteger"
},
"simpleTypes": {
"enum": [
"array",
"boolean",
"integer",
"null",
"number",
"object",
"string"
]
},
"stringArray": {
"default": [],
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
},
"https://json-schema.org/draft/2020-12/schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/schema",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/content": true,
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
"https://json-schema.org/draft/2020-12/vocab/validation": true
},
"$dynamicAnchor": "meta",
"title": "Core and Validation specifications meta-schema",
"$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
"type": [ "object", "boolean" ],
"allOf": [
{
"$ref": "meta/core"
},
{
"$ref": "meta/applicator"
},
{
"$ref": "meta/unevaluated"
},
{
"$ref": "meta/validation"
},
{
"$ref": "meta/meta-data"
},
{
"$ref": "meta/format-annotation"
},
{
"$ref": "meta/content"
}
],
"properties": {
"$recursiveAnchor": {
"$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".",
"deprecated": true,
"$ref": "meta/core#/$defs/anchorString"
},
"$recursiveRef": {
"$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".",
"deprecated": true,
"$ref": "meta/core#/$defs/uriReferenceString"
},
"dependencies": {
"$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.",
"deprecated": true,
"default": {},
"type": "object",
"additionalProperties": {
"anyOf": [
{
"$dynamicRef": "#meta"
},
{
"$ref": "meta/validation#/$defs/stringArray"
}
]
}
},
"definitions": {
"$comment": "\"definitions\" has been replaced by \"$defs\".",
"deprecated": true,
"default": {},
"type": "object",
"additionalProperties": {
"$dynamicRef": "#meta"
}
}
}
},
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/links",
"title": "Link Description Object",
"type": "object",
"required": [ "rel", "href" ],
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"$comment": {
"type": "string"
},
"anchor": {
"type": "string",
"format": "uri-template"
},
"anchorPointer": {
"type": "string",
"anyOf": [
{
"format": "json-pointer"
},
{
"format": "relative-json-pointer"
}
]
},
"headerSchema": {
"default": true,
"$dynamicRef": "https://json-schema.org/draft/2020-12/hyper-schema#meta"
},
"href": {
"type": "string",
"format": "uri-template"
},
"hrefSchema": {
"default": false,
"$dynamicRef": "https://json-schema.org/draft/2020-12/hyper-schema#meta"
},
"rel": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"minItems": 1,
"items": {
"type": "string"
}
}
]
},
"submissionMediaType": {
"default": "application/json",
"type": "string"
},
"submissionSchema": {
"default": true,
"$dynamicRef": "https://json-schema.org/draft/2020-12/hyper-schema#meta"
},
"targetHints": {},
"targetMediaType": {
"type": "string"
},
"targetSchema": {
"default": true,
"$dynamicRef": "https://json-schema.org/draft/2020-12/hyper-schema#meta"
},
"templatePointers": {
"type": "object",
"additionalProperties": {
"type": "string",
"anyOf": [
{
"format": "json-pointer"
},
{
"format": "relative-json-pointer"
}
]
}
},
"templateRequired": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment