{
    "id": "http://schemas.gdbots.io/json-schema/gdbots/pbjx/envelope/1-0-1.json#",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "_schema": {
            "type": "string",
            "pattern": "^pbj:([a-z0-9-]+):([a-z0-9\\.-]+):([a-z0-9-]+)?:([a-z0-9-]+):([0-9]+-[0-9]+-[0-9]+)$",
            "default": "pbj:gdbots:pbjx::envelope:1-0-1"
        },
        "envelope_id": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "ok": {
            "type": "boolean",
            "default": true
        },
        "code": {
            "type": "integer",
            "default": 0,
            "minimum": 0,
            "maximum": 65535
        },
        "http_code": {
            "type": "integer",
            "default": 200,
            "enum": [
                0,
                100,
                101,
                102,
                200,
                201,
                202,
                203,
                204,
                205,
                206,
                207,
                208,
                226,
                300,
                301,
                302,
                303,
                304,
                305,
                306,
                307,
                308,
                400,
                401,
                402,
                403,
                404,
                405,
                406,
                407,
                408,
                409,
                410,
                411,
                412,
                413,
                414,
                415,
                416,
                417,
                418,
                422,
                423,
                424,
                425,
                426,
                428,
                429,
                499,
                431,
                451,
                500,
                501,
                502,
                503,
                504,
                505,
                506,
                507,
                508,
                510,
                511
            ]
        },
        "etag": {
            "type": "string",
            "pattern": "^[\\w\\.:-]+$"
        },
        "error_name": {
            "type": "string",
            "pattern": "^[\\w\\/\\.:-]+$"
        },
        "error_message": {
            "type": "string",
            "minLength": 0,
            "maxLength": 65535
        },
        "message_ref": {
            "type": "object",
            "properties": {
                "curie": {
                    "type": "string",
                    "pattern": "^([a-z0-9-]+):([a-z0-9\\.-]+):([a-z0-9-]+)?:([a-z0-9-]+)$",
                    "minLength": 0,
                    "maxLength": 146
                },
                "id": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9:_\\-]+$",
                    "minLength": 0,
                    "maxLength": 255
                },
                "tag": {
                    "type": "string",
                    "pattern": "^([\\w\\/-]|[\\w-][\\w\\/-]*[\\w-])$",
                    "minLength": 0,
                    "maxLength": 255
                }
            },
            "required": [
                "curie",
                "id"
            ],
            "additionalProperties": false
        },
        "message": {
            "type": "object"
        },
        "derefs": {
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z_]{1}[\\w\\.:-]+$": {
                    "type": "object"
                }
            },
            "additionalProperties": false,
            "description": "Some pbjx operations (normally requests) can include \"dereferenced\" messages on the envelope to prevent the consumer from needing to make multiple HTTP requests. It is up to the consumer to make use of the dereferenced messages if/when they are provided."
        }
    },
    "required": [
        "_schema",
        "envelope_id"
    ],
    "additionalProperties": false
}