UNPKG

@tsed/schema

Version:
58 lines (57 loc) 2.01 kB
/** * Standard JSON Schema format types for string validation. * * These format types provide semantic validation for string values beyond basic * pattern matching. They are part of the JSON Schema specification and widely * supported by validation libraries. * * ### Date and Time Formats * - **DATE_TIME**: RFC 3339 date-time (e.g., "2024-01-15T10:30:00Z") * - **DATE**: RFC 3339 full-date (e.g., "2024-01-15") * - **TIME**: RFC 3339 full-time (e.g., "10:30:00") * * ### Network Formats * - **EMAIL**: Email address (RFC 5322) * - **HOSTNAME**: Internet hostname (RFC 1123) * - **IPV4**: IPv4 address * - **IPV6**: IPv6 address * - **URI**: Uniform Resource Identifier (RFC 3986) * - **URL**: URL variant of URI * - **URI_REF**: URI reference * - **URI_TEMPLATE**: URI template (RFC 6570) * * ### Other Formats * - **JSON_POINTER**: JSON Pointer (RFC 6901) * - **RELATIVE_JSON_POINTER**: Relative JSON Pointer * - **UUID**: Universally Unique Identifier (RFC 4122) * - **REGEX**: Regular expression (ECMA-262) * * ### Usage * * ```typescript * import {JsonFormatTypes} from "@tsed/schema"; * * schema.format(JsonFormatTypes.EMAIL); * schema.format(JsonFormatTypes.DATE_TIME); * ``` * * @public */ export var JsonFormatTypes; (function (JsonFormatTypes) { JsonFormatTypes["DATE_TIME"] = "date-time"; JsonFormatTypes["DATE"] = "date"; JsonFormatTypes["TIME"] = "time"; JsonFormatTypes["EMAIL"] = "email"; JsonFormatTypes["HOSTNAME"] = "hostname"; JsonFormatTypes["IPV4"] = "ipv4"; JsonFormatTypes["IPV6"] = "ipv6"; JsonFormatTypes["URI"] = "uri"; JsonFormatTypes["URL"] = "url"; JsonFormatTypes["URI_REF"] = "uri-reference"; JsonFormatTypes["URI_TEMPLATE"] = "uri-template"; JsonFormatTypes["JSON_POINTER"] = "json-pointer"; JsonFormatTypes["RELATIVE_JSON_POINTER"] = "relative-json-pointer"; JsonFormatTypes["UUID"] = "uuid"; JsonFormatTypes["REGEX"] = "regex"; })(JsonFormatTypes || (JsonFormatTypes = {}));