-- schema.json --
{
    "$schema": "https://json-schema.org/draft/2019-09/schema",
    "type": "object",
    "title": "Main schema",
    "description": "Specify who you are and all.",
    "$defs": {
        "address": {
            "description": "address stores a postal address",
            "type": "string",
            "minLength": 4,
            "maxLength": 20
        },
        "phone number": {
            "description": "a telephone number",
            "type": "string"
        }
    },
    "properties": {
        "person": {
            "description": "A person is a human being.",
            "type": "object",
            "required": [
                "name"
            ],
            "properties": {
                "name": {
                    "type": "string",
                    "examples": [
                        "foo"
                    ]
                },
                "address": {
                    "description": "where does this person live?",
                    "$ref": "#/$defs/address"
                },
                "children": {
                    "description": "A very large comment that will be wrapped after a certain line length. Let's keep on going and see what happens.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "default": []
                },
                "home phone": {
                    "$ref": "#/$defs/phone number",
                    "deprecated": true
                },
                "bio": {
                    "description": "AllConditions enable variable-based conditional rule execution. This is useful for\nfiner control of when an rule is applied. A condition can reference object data\nusing JMESPath notation.\nHere, all of the conditions need to pass.\n",
                    "type": "string"
                }
            }
        }
    }
}
-- out/decode/extract --
// Main schema
//
// Specify who you are and all.

import "strings"

@jsonschema(schema="https://json-schema.org/draft/2019-09/schema")

// A person is a human being.
person?: {
	name!: string

	// where does this person live?
	address?: #address

	// A very large comment that will be wrapped after a certain line length. Let's
	// keep on going and see what happens.
	children?: [...string]
	"home phone"?: #."phone number" @deprecated()

	// AllConditions enable variable-based conditional rule execution. This is useful for
	// finer control of when an rule is applied. A condition can reference object data
	// using JMESPath notation.
	// Here, all of the conditions need to pass.
	bio?: string
	...
}

// a telephone number
#: "phone number": string

// address stores a postal address
#address: strings.MinRunes(4) & strings.MaxRunes(20)
...
