json-schema-typed
Version:
JSON Schema TypeScript definitions with complete inline documentation.
373 lines (372 loc) • 13.6 kB
JavaScript
// @generated
// This code is automatically generated. Manual editing is not recommended.
/*
* BSD-3-Clause License
*
* Original source code is copyright (c) 2019-2026 Remy Rylan
* <https://github.com/RemyRylan>
*
* Documentation and keyword descriptions are copyright (c) 2022 JSON Schema
* Specification Authors <https://github.com/json-schema-org/json-schema-spec>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
export const draft = "v1";
export const $schema = "https://json-schema.org/v1";
// -----------------------------------------------------------------------------
/**
* Content encoding strategy enum.
*
* - [RFC 4648: The Base16, Base32, and Base64 Data Encodings](https://datatracker.ietf.org/doc/html/rfc4648)
* - [Content-Transfer-Encoding Syntax](https://datatracker.ietf.org/doc/html/rfc2045#section-6.1)
* - [7bit vs 8bit encoding](https://stackoverflow.com/questions/25710599/content-transfer-encoding-7bit-or-8-bit/28531705#28531705)
*/
export var ContentEncoding;
(function (ContentEncoding) {
/**
* Only US-ASCII characters, which use the lower 7 bits for each character.
*
* Each line must be less than 1,000 characters.
*/
ContentEncoding["7bit"] = "7bit";
/**
* Allow extended ASCII characters which can use the 8th (highest) bit to
* indicate special characters not available in 7bit.
*
* Each line must be less than 1,000 characters.
*/
ContentEncoding["8bit"] = "8bit";
/**
* Hexadecimal encoding using the alphabet `0-9A-F`, as defined by
* [RFC 4648, Section 8](https://datatracker.ietf.org/doc/html/rfc4648#section-8).
*/
ContentEncoding["Base16"] = "base16";
/**
* Base 32 encoding using the alphabet `A-Z2-7`, as defined by
* [RFC 4648, Section 6](https://datatracker.ietf.org/doc/html/rfc4648#section-6).
*/
ContentEncoding["Base32"] = "base32";
/**
* Base 32 encoding using the "Extended Hex" alphabet `0-9A-V`, as defined by
* [RFC 4648, Section 7](https://datatracker.ietf.org/doc/html/rfc4648#section-7).
*/
ContentEncoding["Base32Hex"] = "base32hex";
/**
* Base 64 encoding as defined by
* [RFC 4648, Section 4](https://datatracker.ietf.org/doc/html/rfc4648#section-4).
* Useful for data that is mostly non-text. Where RFC 2045 and RFC 4648
* differ, the RFC 4648 definition (no line length limit) SHOULD be assumed.
*/
ContentEncoding["Base64"] = "base64";
/**
* Base 64 encoding with the URL and filename safe alphabet (`-` and `_`
* instead of `+` and `/`), as defined by
* [RFC 4648, Section 5](https://datatracker.ietf.org/doc/html/rfc4648#section-5).
*/
ContentEncoding["Base64URL"] = "base64url";
/**
* Same character set as 8bit, with no line length restriction.
*/
ContentEncoding["Binary"] = "binary";
/**
* An extension token defined by a standards-track RFC and registered with
* IANA.
*/
ContentEncoding["IETFToken"] = "ietf-token";
/**
* Lines are limited to 76 characters, and line breaks are represented using
* special characters that are escaped.
*/
ContentEncoding["QuotedPrintable"] = "quoted-printable";
/**
* The two characters "X-" or "x-" followed, with no intervening white space,
* by any token.
*/
ContentEncoding["XToken"] = "x-token";
})(ContentEncoding || (ContentEncoding = {}));
/**
* The formats defined by the JSON Schema specification. All of them apply to
* string instances. Additional formats are listed in the [format
* registry][registry], and implementations are encouraged to support those as
* if they were defined by the specification.
*
* [registry]:
* https://github.com/json-schema-org/json-schema-spec/blob/main/specs/registries/format.json
*/
export var Format;
(function (Format) {
/**
* A string instance is valid against this attribute if it is a valid
* representation according to the "full-date" ABNF rule in [RFC
* 3339][RFC3339].
*
* [RFC3339]: https://www.rfc-editor.org/info/rfc3339
*/
Format["Date"] = "date";
/**
* A string instance is valid against this attribute if it is a valid
* representation of the "date-time-ext" rule in [RFC 9557][RFC9557]. This
* SHOULD allow and validate published leap seconds. See [RFC 3339, section
* 5.7][RFC3339].
*
* [RFC9557]: https://www.rfc-editor.org/info/rfc9557
* [RFC3339]: https://www.rfc-editor.org/info/rfc3339
*/
Format["DateTime"] = "date-time";
/**
* A string instance is valid against this attribute if it is a valid
* representation according to the "duration" ABNF rule in [RFC 3339, Appendix
* A][RFC3339].
*
* [RFC3339]: https://www.rfc-editor.org/info/rfc3339
*/
Format["Duration"] = "duration";
/**
* A string instance is valid against this attribute if it is a valid Internet
* email address as defined by the "Mailbox" ABNF rule in [RFC 5321][RFC5321],
* section 4.1.2.
*
* [RFC5321]: https://datatracker.ietf.org/doc/html/rfc5321
*/
Format["Email"] = "email";
/**
* A string instance is valid against this attribute if it is a valid
* representation for an Internet hostname as defined by [RFC 1123, section
* 2.1][RFC1123].
*
* [RFC1123]: https://www.rfc-editor.org/info/rfc1123
*/
Format["Hostname"] = "hostname";
/**
* An IPv4 address according to the "dotted-quad" ABNF syntax as defined in
* [RFC 2673, section 3.2][RFC2673].
*
* [RFC2673]: https://datatracker.ietf.org/doc/html/rfc2673
*/
Format["IPv4"] = "ipv4";
/**
* An IPv6 address as defined in [RFC 4291, section 2.2][RFC4291].
*
* [RFC4291]: https://datatracker.ietf.org/doc/html/rfc4291
*/
Format["IPv6"] = "ipv6";
/**
* A string instance is valid against this attribute if it is a valid IRI,
* according to [RFC 3987][RFC3987].
*
* [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987
*/
Format["IRI"] = "iri";
/**
* A string instance is valid against this attribute if it is a valid IRI
* Reference (either an IRI or a relative-reference), according to [RFC
* 3987][RFC3987].
*
* [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987
*/
Format["IRIReference"] = "iri-reference";
/**
* A string instance is valid against this attribute if it is a valid JSON
* string representation of a JSON Pointer, according to [RFC 6901, section
* 5][RFC6901].
*
* [RFC6901]: https://datatracker.ietf.org/doc/html/rfc6901
*/
Format["JSONPointer"] = "json-pointer";
/**
* A regular expression, which SHOULD be valid according to the
* [ECMA-262][ecma262] regular expression dialect.
*
* Implementations that validate formats MUST accept at least the subset of
* [ECMA-262][ecma262] defined in the Regular Expressions section of the
* validation specification, and SHOULD accept all valid [ECMA-262][ecma262]
* expressions.
*
* [ecma262]: https://www.ecma-international.org/ecma-262/11.0/index.html
*/
Format["RegEx"] = "regex";
/**
* A string instance is valid against this attribute if it is a valid
* [Relative JSON Pointer][relative-json-pointer]. To allow for both absolute
* and relative JSON Pointers, use `anyOf` or `oneOf` to indicate support for
* either format.
*
* [relative-json-pointer]:
* https://datatracker.ietf.org/doc/html/draft-handrews-relative-json-pointer-01
*/
Format["RelativeJSONPointer"] = "relative-json-pointer";
/**
* A string instance is valid against this attribute if it is a valid
* representation according to the "full-time" ABNF rule in [RFC
* 3339][RFC3339]. This MUST NOT include leap seconds.
*
* The `time` format represents a time value that is independent of any
* specific date, such as a scheduled time of day or a measured duration.
* Because there is no date, it is not well suited for capturing a moment in
* time; for that, use `date-time`.
*
* [RFC3339]: https://www.rfc-editor.org/info/rfc3339
*/
Format["Time"] = "time";
/**
* A string instance is valid against this attribute if it is a valid URI,
* according to [RFC3986][RFC3986].
*
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
*/
Format["URI"] = "uri";
/**
* A string instance is valid against this attribute if it is a valid URI
* Reference (either a URI or a relative-reference), according to
* [RFC3986][RFC3986].
*
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
*/
Format["URIReference"] = "uri-reference";
/**
* A string instance is valid against this attribute if it is a valid URI
* Template (of any level), according to [RFC 6570][RFC6570].
*
* Note that URI Templates may be used for IRIs; there is no separate IRI
* Template specification.
*
* [RFC6570]: https://www.rfc-editor.org/info/rfc6570
*/
Format["URITemplate"] = "uri-template";
/**
* A string instance is valid against this attribute if it is a valid string
* representation of a UUID, according to [RFC 4122][RFC4122].
*
* Note that the `uuid` format is for plain UUIDs, not UUIDs in URNs. An
* example is `f81d4fae-7dec-11d0-a765-00a0c91e6bf6`. For UUIDs as URNs, use
* the `uri` format, with a `pattern` regular expression of `^urn:uuid:` to
* indicate the URI scheme and URN namespace.
*
* [RFC4122]: https://www.rfc-editor.org/info/rfc4122
*/
Format["UUID"] = "uuid";
})(Format || (Format = {}));
/**
* Enum consisting of simple type names for the `type` keyword
*/
export var TypeName;
(function (TypeName) {
/**
* Value MUST be an array.
*/
TypeName["Array"] = "array";
/**
* Value MUST be a boolean.
*/
TypeName["Boolean"] = "boolean";
/**
* Value MUST be an integer, no floating point numbers are allowed. This is a
* subset of the number type.
*/
TypeName["Integer"] = "integer";
/**
* Value MUST be null. Note this is mainly for purpose of being able use union
* types to define nullability. If this type is not included in a union, null
* values are not allowed (the primitives listed above do not allow nulls on
* their own).
*/
TypeName["Null"] = "null";
/**
* Value MUST be a number, floating point numbers are allowed.
*/
TypeName["Number"] = "number";
/**
* Value MUST be an object.
*/
TypeName["Object"] = "object";
/**
* Value MUST be a string.
*/
TypeName["String"] = "string";
})(TypeName || (TypeName = {}));
// -----------------------------------------------------------------------------
// Keywords
// -----------------------------------------------------------------------------
export const keywords = [
"$anchor",
"$comment",
"$defs",
"$dynamicAnchor",
"$dynamicRef",
"$id",
"$ref",
"$schema",
"additionalProperties",
"allOf",
"anyOf",
"const",
"contains",
"contentEncoding",
"contentMediaType",
"contentSchema",
"default",
"dependentRequired",
"dependentSchemas",
"deprecated",
"description",
"else",
"enum",
"examples",
"exclusiveMaximum",
"exclusiveMinimum",
"format",
"if",
"items",
"maxContains",
"maximum",
"maxItems",
"maxLength",
"maxProperties",
"minContains",
"minimum",
"minItems",
"minLength",
"minProperties",
"multipleOf",
"not",
"oneOf",
"pattern",
"patternProperties",
"prefixItems",
"properties",
"propertyNames",
"readOnly",
"required",
"then",
"title",
"type",
"unevaluatedItems",
"unevaluatedProperties",
"uniqueItems",
"writeOnly",
];