@typia/interface 12.0.0-dev.20260309 → 12.0.0-dev.20260311

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/lib/http/IHttpLlmController.d.ts +5 -5
  2. package/lib/schema/IJsonParseResult.d.ts +1 -3
  3. package/lib/schema/ILlmApplication.d.ts +1 -2
  4. package/lib/schema/ILlmController.d.ts +2 -5
  5. package/lib/schema/ILlmSchema.d.ts +1 -11
  6. package/package.json +1 -1
  7. package/src/http/IHttpConnection.ts +200 -200
  8. package/src/http/IHttpLlmApplication.ts +72 -72
  9. package/src/http/IHttpLlmController.ts +96 -96
  10. package/src/http/IHttpLlmFunction.ts +34 -34
  11. package/src/http/IHttpMigrateApplication.ts +48 -48
  12. package/src/http/IHttpMigrateRoute.ts +165 -165
  13. package/src/http/IHttpResponse.ts +42 -42
  14. package/src/http/index.ts +7 -7
  15. package/src/index.ts +9 -9
  16. package/src/metadata/IJsDocTagInfo.ts +25 -25
  17. package/src/metadata/IMetadataComponents.ts +24 -24
  18. package/src/metadata/IMetadataSchema.ts +293 -293
  19. package/src/metadata/IMetadataSchemaCollection.ts +20 -20
  20. package/src/metadata/IMetadataSchemaUnit.ts +20 -20
  21. package/src/metadata/IMetadataTypeTag.ts +39 -39
  22. package/src/metadata/index.ts +6 -6
  23. package/src/openapi/OpenApi.ts +643 -643
  24. package/src/openapi/OpenApiV3.ts +655 -655
  25. package/src/openapi/OpenApiV3_1.ts +735 -735
  26. package/src/openapi/SwaggerV2.ts +559 -559
  27. package/src/openapi/index.ts +4 -4
  28. package/src/protobuf/ProtobufWire.ts +51 -51
  29. package/src/protobuf/index.ts +1 -1
  30. package/src/schema/IJsonParseResult.ts +134 -136
  31. package/src/schema/IJsonSchemaApplication.ts +274 -274
  32. package/src/schema/IJsonSchemaAttribute.ts +158 -158
  33. package/src/schema/IJsonSchemaCollection.ts +123 -123
  34. package/src/schema/IJsonSchemaTransformError.ts +86 -86
  35. package/src/schema/IJsonSchemaUnit.ts +120 -120
  36. package/src/schema/ILlmApplication.ts +98 -99
  37. package/src/schema/ILlmController.ts +54 -57
  38. package/src/schema/ILlmFunction.ts +145 -145
  39. package/src/schema/ILlmSchema.ts +473 -484
  40. package/src/schema/IResult.ts +84 -84
  41. package/src/schema/IValidation.ts +134 -134
  42. package/src/schema/index.ts +14 -14
  43. package/src/tags/Constant.ts +49 -49
  44. package/src/tags/ContentMediaType.ts +40 -40
  45. package/src/tags/Default.ts +50 -50
  46. package/src/tags/Example.ts +48 -48
  47. package/src/tags/Examples.ts +50 -50
  48. package/src/tags/ExclusiveMaximum.ts +46 -46
  49. package/src/tags/ExclusiveMinimum.ts +46 -46
  50. package/src/tags/Format.ts +76 -76
  51. package/src/tags/JsonSchemaPlugin.ts +45 -45
  52. package/src/tags/MaxItems.ts +39 -39
  53. package/src/tags/MaxLength.ts +37 -37
  54. package/src/tags/Maximum.ts +44 -44
  55. package/src/tags/MinItems.ts +39 -39
  56. package/src/tags/MinLength.ts +37 -37
  57. package/src/tags/Minimum.ts +44 -44
  58. package/src/tags/MultipleOf.ts +54 -54
  59. package/src/tags/Pattern.ts +59 -59
  60. package/src/tags/Sequence.ts +43 -43
  61. package/src/tags/TagBase.ts +131 -131
  62. package/src/tags/Type.ts +70 -70
  63. package/src/tags/UniqueItems.ts +44 -44
  64. package/src/tags/index.ts +21 -21
  65. package/src/typings/AssertionGuard.ts +12 -12
  66. package/src/typings/Atomic.ts +21 -21
  67. package/src/typings/CamelCase.ts +75 -75
  68. package/src/typings/ClassProperties.ts +15 -15
  69. package/src/typings/DeepPartial.ts +39 -39
  70. package/src/typings/OmitNever.ts +12 -12
  71. package/src/typings/PascalCase.ts +71 -71
  72. package/src/typings/Primitive.ts +71 -71
  73. package/src/typings/ProtobufAtomic.ts +30 -30
  74. package/src/typings/Resolved.ts +58 -58
  75. package/src/typings/SnakeCase.ts +126 -126
  76. package/src/typings/SpecialFields.ts +13 -13
  77. package/src/typings/ValidationPipe.ts +20 -20
  78. package/src/typings/index.ts +14 -14
  79. package/src/typings/internal/Equal.ts +14 -14
  80. package/src/typings/internal/IsTuple.ts +17 -17
  81. package/src/typings/internal/NativeClass.ts +31 -31
  82. package/src/typings/internal/ValueOf.ts +29 -29
  83. package/src/utils/IRandomGenerator.ts +105 -105
  84. package/src/utils/IReadableURLSearchParams.ts +25 -25
  85. package/src/utils/index.ts +2 -2
@@ -1,50 +1,50 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Default value metadata for JSON Schema generation.
5
- *
6
- * `Default<Value>` is a type tag that specifies a default value for a property
7
- * in the generated JSON Schema. This is metadata-only - typia does not
8
- * automatically apply default values at runtime.
9
- *
10
- * The default value appears in the `default` field of the JSON Schema output,
11
- * which API documentation tools and code generators can use to show default
12
- * values or generate code that applies them.
13
- *
14
- * Only primitive literal types are supported: `boolean`, `bigint`, `number`,
15
- * and `string`. For complex defaults, consider using optional properties with
16
- * runtime default assignment.
17
- *
18
- * @author Jeongho Nam - https://github.com/samchon
19
- * @example
20
- * interface Config {
21
- * // Default to 10 items per page
22
- * pageSize: (number & Default<10>) | undefined;
23
- * // Default to enabled
24
- * enabled: (boolean & Default<true>) | undefined;
25
- * // Default sort order
26
- * sortOrder: (string & Default<"asc">) | undefined;
27
- * }
28
- *
29
- * @template Value The default value literal (must be a primitive)
30
- */
31
- export type Default<Value extends boolean | bigint | number | string> =
32
- TagBase<{
33
- target: Value extends boolean
34
- ? "boolean"
35
- : Value extends bigint
36
- ? "bigint"
37
- : Value extends number
38
- ? "number"
39
- : "string";
40
- kind: "default";
41
- value: Value;
42
- exclusive: true;
43
- schema: Value extends bigint
44
- ? { default: Numeric<Value> }
45
- : { default: Value };
46
- }>;
47
-
48
- type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
49
- ? N
50
- : never;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Default value metadata for JSON Schema generation.
5
+ *
6
+ * `Default<Value>` is a type tag that specifies a default value for a property
7
+ * in the generated JSON Schema. This is metadata-only - typia does not
8
+ * automatically apply default values at runtime.
9
+ *
10
+ * The default value appears in the `default` field of the JSON Schema output,
11
+ * which API documentation tools and code generators can use to show default
12
+ * values or generate code that applies them.
13
+ *
14
+ * Only primitive literal types are supported: `boolean`, `bigint`, `number`,
15
+ * and `string`. For complex defaults, consider using optional properties with
16
+ * runtime default assignment.
17
+ *
18
+ * @author Jeongho Nam - https://github.com/samchon
19
+ * @example
20
+ * interface Config {
21
+ * // Default to 10 items per page
22
+ * pageSize: (number & Default<10>) | undefined;
23
+ * // Default to enabled
24
+ * enabled: (boolean & Default<true>) | undefined;
25
+ * // Default sort order
26
+ * sortOrder: (string & Default<"asc">) | undefined;
27
+ * }
28
+ *
29
+ * @template Value The default value literal (must be a primitive)
30
+ */
31
+ export type Default<Value extends boolean | bigint | number | string> =
32
+ TagBase<{
33
+ target: Value extends boolean
34
+ ? "boolean"
35
+ : Value extends bigint
36
+ ? "bigint"
37
+ : Value extends number
38
+ ? "number"
39
+ : "string";
40
+ kind: "default";
41
+ value: Value;
42
+ exclusive: true;
43
+ schema: Value extends bigint
44
+ ? { default: Numeric<Value> }
45
+ : { default: Value };
46
+ }>;
47
+
48
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
49
+ ? N
50
+ : never;
@@ -1,48 +1,48 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Single example value for JSON Schema documentation.
5
- *
6
- * `Example<Value>` is a type tag that adds a representative example value to
7
- * the generated JSON Schema. This is metadata-only - it appears in the
8
- * `example` field of the schema and helps API consumers understand expected
9
- * values.
10
- *
11
- * Examples are displayed in API documentation tools like Swagger UI and can be
12
- * used by code generators to produce more helpful client code.
13
- *
14
- * Supports all JSON-compatible types: primitives, objects, arrays, and null.
15
- * For multiple named examples, use {@link Examples} instead.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * interface User {
20
- * email: string & Format<"email"> & Example<"user@example.com">;
21
- * age: number & Minimum<0> & Example<25>;
22
- * tags: string[] & Example<["admin", "active"]>;
23
- * }
24
- *
25
- * @template Value The example value (any JSON-compatible type)
26
- */
27
- export type Example<
28
- Value extends
29
- | boolean
30
- | bigint
31
- | number
32
- | string
33
- | object
34
- | Array<unknown>
35
- | null,
36
- > = TagBase<{
37
- target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
38
- kind: "example";
39
- value: Value;
40
- exclusive: true;
41
- schema: Value extends bigint
42
- ? { example: Numeric<Value> }
43
- : { example: Value };
44
- }>;
45
-
46
- type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
47
- ? N
48
- : never;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Single example value for JSON Schema documentation.
5
+ *
6
+ * `Example<Value>` is a type tag that adds a representative example value to
7
+ * the generated JSON Schema. This is metadata-only - it appears in the
8
+ * `example` field of the schema and helps API consumers understand expected
9
+ * values.
10
+ *
11
+ * Examples are displayed in API documentation tools like Swagger UI and can be
12
+ * used by code generators to produce more helpful client code.
13
+ *
14
+ * Supports all JSON-compatible types: primitives, objects, arrays, and null.
15
+ * For multiple named examples, use {@link Examples} instead.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface User {
20
+ * email: string & Format<"email"> & Example<"user@example.com">;
21
+ * age: number & Minimum<0> & Example<25>;
22
+ * tags: string[] & Example<["admin", "active"]>;
23
+ * }
24
+ *
25
+ * @template Value The example value (any JSON-compatible type)
26
+ */
27
+ export type Example<
28
+ Value extends
29
+ | boolean
30
+ | bigint
31
+ | number
32
+ | string
33
+ | object
34
+ | Array<unknown>
35
+ | null,
36
+ > = TagBase<{
37
+ target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
38
+ kind: "example";
39
+ value: Value;
40
+ exclusive: true;
41
+ schema: Value extends bigint
42
+ ? { example: Numeric<Value> }
43
+ : { example: Value };
44
+ }>;
45
+
46
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
47
+ ? N
48
+ : never;
@@ -1,50 +1,50 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Multiple named examples for JSON Schema documentation.
5
- *
6
- * `Examples<Record>` is a type tag that adds multiple labeled example values to
7
- * the generated JSON Schema. Each example has a name and a value, providing
8
- * rich documentation for different use cases or scenarios.
9
- *
10
- * This is useful when a property can have various valid values and you want to
11
- * illustrate multiple possibilities, such as different user types, edge cases,
12
- * or common configurations.
13
- *
14
- * The examples appear in the `examples` field of the JSON Schema and are
15
- * displayed by API documentation tools. For a single unnamed example, use
16
- * {@link Example} instead.
17
- *
18
- * @author Jeongho Nam - https://github.com/samchon
19
- * @example
20
- * interface Product {
21
- * price: number &
22
- * Examples<{
23
- * budget: 9.99;
24
- * premium: 99.99;
25
- * enterprise: 999.99;
26
- * }>;
27
- * status: string &
28
- * Examples<{
29
- * active: "active";
30
- * discontinued: "discontinued";
31
- * preorder: "preorder";
32
- * }>;
33
- * }
34
- *
35
- * @template Value Record mapping example names to their values
36
- */
37
- export type Examples<
38
- Value extends Record<
39
- string,
40
- boolean | bigint | number | string | object | Array<unknown> | null
41
- >,
42
- > = TagBase<{
43
- target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
44
- kind: "examples";
45
- value: Value;
46
- exclusive: true;
47
- schema: {
48
- examples: Value;
49
- };
50
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Multiple named examples for JSON Schema documentation.
5
+ *
6
+ * `Examples<Record>` is a type tag that adds multiple labeled example values to
7
+ * the generated JSON Schema. Each example has a name and a value, providing
8
+ * rich documentation for different use cases or scenarios.
9
+ *
10
+ * This is useful when a property can have various valid values and you want to
11
+ * illustrate multiple possibilities, such as different user types, edge cases,
12
+ * or common configurations.
13
+ *
14
+ * The examples appear in the `examples` field of the JSON Schema and are
15
+ * displayed by API documentation tools. For a single unnamed example, use
16
+ * {@link Example} instead.
17
+ *
18
+ * @author Jeongho Nam - https://github.com/samchon
19
+ * @example
20
+ * interface Product {
21
+ * price: number &
22
+ * Examples<{
23
+ * budget: 9.99;
24
+ * premium: 99.99;
25
+ * enterprise: 999.99;
26
+ * }>;
27
+ * status: string &
28
+ * Examples<{
29
+ * active: "active";
30
+ * discontinued: "discontinued";
31
+ * preorder: "preorder";
32
+ * }>;
33
+ * }
34
+ *
35
+ * @template Value Record mapping example names to their values
36
+ */
37
+ export type Examples<
38
+ Value extends Record<
39
+ string,
40
+ boolean | bigint | number | string | object | Array<unknown> | null
41
+ >,
42
+ > = TagBase<{
43
+ target: "boolean" | "bigint" | "number" | "string" | "array" | "object";
44
+ kind: "examples";
45
+ value: Value;
46
+ exclusive: true;
47
+ schema: {
48
+ examples: Value;
49
+ };
50
+ }>;
@@ -1,46 +1,46 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Exclusive maximum value constraint (value < max).
5
- *
6
- * `ExclusiveMaximum<N>` is a type tag that validates numeric values are
7
- * strictly less than the specified bound (not equal). Apply it to `number` or
8
- * `bigint` properties using TypeScript intersection types.
9
- *
10
- * This constraint is **mutually exclusive** with {@link Maximum} - you cannot
11
- * use both on the same property. Use `ExclusiveMaximum` for exclusive bounds
12
- * (<) and `Maximum` for inclusive bounds (<=).
13
- *
14
- * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
- * `typia.validate()`. It also generates `exclusiveMaximum` in JSON Schema.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * interface Temperature {
20
- * // Must be less than 100 (boiling point), not equal
21
- * celsius: number & ExclusiveMaximum<100>;
22
- * }
23
- *
24
- * @template Value The maximum bound (exclusive - value must be less)
25
- */
26
- export type ExclusiveMaximum<Value extends number | bigint> = TagBase<{
27
- target: Value extends bigint ? "bigint" : "number";
28
- kind: "exclusiveMaximum";
29
- value: Value;
30
- validate: `$input < ${Cast<Value>}`;
31
- exclusive: ["exclusiveMaximum", "maximum"];
32
- schema: Value extends bigint
33
- ? {
34
- exclusiveMaximum: Numeric<Value>;
35
- }
36
- : {
37
- exclusiveMaximum: Value;
38
- };
39
- }>;
40
-
41
- type Cast<Value extends number | bigint> = Value extends number
42
- ? Value
43
- : `BigInt(${Value})`;
44
- type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
45
- ? N
46
- : never;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Exclusive maximum value constraint (value < max).
5
+ *
6
+ * `ExclusiveMaximum<N>` is a type tag that validates numeric values are
7
+ * strictly less than the specified bound (not equal). Apply it to `number` or
8
+ * `bigint` properties using TypeScript intersection types.
9
+ *
10
+ * This constraint is **mutually exclusive** with {@link Maximum} - you cannot
11
+ * use both on the same property. Use `ExclusiveMaximum` for exclusive bounds
12
+ * (<) and `Maximum` for inclusive bounds (<=).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It also generates `exclusiveMaximum` in JSON Schema.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Temperature {
20
+ * // Must be less than 100 (boiling point), not equal
21
+ * celsius: number & ExclusiveMaximum<100>;
22
+ * }
23
+ *
24
+ * @template Value The maximum bound (exclusive - value must be less)
25
+ */
26
+ export type ExclusiveMaximum<Value extends number | bigint> = TagBase<{
27
+ target: Value extends bigint ? "bigint" : "number";
28
+ kind: "exclusiveMaximum";
29
+ value: Value;
30
+ validate: `$input < ${Cast<Value>}`;
31
+ exclusive: ["exclusiveMaximum", "maximum"];
32
+ schema: Value extends bigint
33
+ ? {
34
+ exclusiveMaximum: Numeric<Value>;
35
+ }
36
+ : {
37
+ exclusiveMaximum: Value;
38
+ };
39
+ }>;
40
+
41
+ type Cast<Value extends number | bigint> = Value extends number
42
+ ? Value
43
+ : `BigInt(${Value})`;
44
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
45
+ ? N
46
+ : never;
@@ -1,46 +1,46 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Exclusive minimum value constraint (value > min).
5
- *
6
- * `ExclusiveMinimum<N>` is a type tag that validates numeric values are
7
- * strictly greater than the specified bound (not equal). Apply it to `number`
8
- * or `bigint` properties using TypeScript intersection types.
9
- *
10
- * This constraint is **mutually exclusive** with {@link Minimum} - you cannot
11
- * use both on the same property. Use `ExclusiveMinimum` for exclusive bounds
12
- * (>) and `Minimum` for inclusive bounds (>=).
13
- *
14
- * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
- * `typia.validate()`. It also generates `exclusiveMinimum` in JSON Schema.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * interface PositiveNumber {
20
- * // Must be greater than 0, not equal to 0
21
- * value: number & ExclusiveMinimum<0>;
22
- * }
23
- *
24
- * @template Value The minimum bound (exclusive - value must be greater)
25
- */
26
- export type ExclusiveMinimum<Value extends number | bigint> = TagBase<{
27
- target: Value extends bigint ? "bigint" : "number";
28
- kind: "exclusiveMinimum";
29
- value: Value;
30
- validate: `${Cast<Value>} < $input`;
31
- exclusive: ["exclusiveMinimum", "minimum"];
32
- schema: Value extends bigint
33
- ? {
34
- exclusiveMinimum: Numeric<Value>;
35
- }
36
- : {
37
- exclusiveMinimum: Value;
38
- };
39
- }>;
40
-
41
- type Cast<Value extends number | bigint> = Value extends number
42
- ? Value
43
- : `BigInt(${Value})`;
44
- type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
45
- ? N
46
- : never;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Exclusive minimum value constraint (value > min).
5
+ *
6
+ * `ExclusiveMinimum<N>` is a type tag that validates numeric values are
7
+ * strictly greater than the specified bound (not equal). Apply it to `number`
8
+ * or `bigint` properties using TypeScript intersection types.
9
+ *
10
+ * This constraint is **mutually exclusive** with {@link Minimum} - you cannot
11
+ * use both on the same property. Use `ExclusiveMinimum` for exclusive bounds
12
+ * (>) and `Minimum` for inclusive bounds (>=).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It also generates `exclusiveMinimum` in JSON Schema.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface PositiveNumber {
20
+ * // Must be greater than 0, not equal to 0
21
+ * value: number & ExclusiveMinimum<0>;
22
+ * }
23
+ *
24
+ * @template Value The minimum bound (exclusive - value must be greater)
25
+ */
26
+ export type ExclusiveMinimum<Value extends number | bigint> = TagBase<{
27
+ target: Value extends bigint ? "bigint" : "number";
28
+ kind: "exclusiveMinimum";
29
+ value: Value;
30
+ validate: `${Cast<Value>} < $input`;
31
+ exclusive: ["exclusiveMinimum", "minimum"];
32
+ schema: Value extends bigint
33
+ ? {
34
+ exclusiveMinimum: Numeric<Value>;
35
+ }
36
+ : {
37
+ exclusiveMinimum: Value;
38
+ };
39
+ }>;
40
+
41
+ type Cast<Value extends number | bigint> = Value extends number
42
+ ? Value
43
+ : `BigInt(${Value})`;
44
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
45
+ ? N
46
+ : never;
@@ -1,76 +1,76 @@
1
- import type { TagBase } from "./TagBase";
2
-
3
- /**
4
- * String format validation constraint.
5
- *
6
- * `Format<Value>` validates strings against predefined formats (email, uuid,
7
- * url, date-time, etc.). Mutually exclusive with {@link Pattern}.
8
- *
9
- * @author Jeongho Nam - https://github.com/samchon
10
- * @template Value Format identifier (see {@link Format.Value} for options)
11
- */
12
- export type Format<Value extends Format.Value> = TagBase<{
13
- target: "string";
14
- kind: "format";
15
- value: Value;
16
- validate: `$importInternal("isFormat${PascalizeString<Value>}")($input)`;
17
- exclusive: ["format", "pattern"];
18
- schema: {
19
- format: Value;
20
- };
21
- }>;
22
- export namespace Format {
23
- /**
24
- * Supported format identifiers.
25
- *
26
- * Standard JSON Schema formats:
27
- *
28
- * - `email`, `idn-email`: Email addresses
29
- * - `hostname`, `idn-hostname`: Hostnames
30
- * - `uri`, `uri-reference`, `uri-template`, `url`: URLs
31
- * - `iri`, `iri-reference`: Internationalized URLs
32
- * - `uuid`: UUID strings
33
- * - `ipv4`, `ipv6`: IP addresses
34
- * - `date-time`, `date`, `time`, `duration`: Date/time formats
35
- * - `json-pointer`, `relative-json-pointer`: JSON pointers
36
- * - `regex`: Regular expression patterns
37
- * - `byte`: Base64-encoded data
38
- * - `password`: Password fields (for documentation only)
39
- */
40
- export type Value =
41
- | "byte"
42
- | "password"
43
- | "regex"
44
- | "uuid"
45
- | "email"
46
- | "hostname"
47
- | "idn-email"
48
- | "idn-hostname"
49
- | "iri"
50
- | "iri-reference"
51
- | "ipv4"
52
- | "ipv6"
53
- | "uri"
54
- | "uri-reference"
55
- | "uri-template"
56
- | "url"
57
- | "date-time"
58
- | "date"
59
- | "time"
60
- | "duration"
61
- | "json-pointer"
62
- | "relative-json-pointer";
63
- }
64
-
65
- type PascalizeString<Key extends string> = Key extends `-${infer R}`
66
- ? `${PascalizeString<R>}`
67
- : Key extends `${infer _F}-${infer _R}`
68
- ? PascalizeSnakeString<Key>
69
- : Capitalize<Key>;
70
- type PascalizeSnakeString<Key extends string> = Key extends `-${infer R}`
71
- ? PascalizeSnakeString<R>
72
- : Key extends `${infer F}${infer M}-${infer R}`
73
- ? `${Uppercase<F>}${Lowercase<M>}${PascalizeSnakeString<R>}`
74
- : Key extends `${infer F}${infer R}`
75
- ? `${Uppercase<F>}${Lowercase<R>}`
76
- : Key;
1
+ import type { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * String format validation constraint.
5
+ *
6
+ * `Format<Value>` validates strings against predefined formats (email, uuid,
7
+ * url, date-time, etc.). Mutually exclusive with {@link Pattern}.
8
+ *
9
+ * @author Jeongho Nam - https://github.com/samchon
10
+ * @template Value Format identifier (see {@link Format.Value} for options)
11
+ */
12
+ export type Format<Value extends Format.Value> = TagBase<{
13
+ target: "string";
14
+ kind: "format";
15
+ value: Value;
16
+ validate: `$importInternal("isFormat${PascalizeString<Value>}")($input)`;
17
+ exclusive: ["format", "pattern"];
18
+ schema: {
19
+ format: Value;
20
+ };
21
+ }>;
22
+ export namespace Format {
23
+ /**
24
+ * Supported format identifiers.
25
+ *
26
+ * Standard JSON Schema formats:
27
+ *
28
+ * - `email`, `idn-email`: Email addresses
29
+ * - `hostname`, `idn-hostname`: Hostnames
30
+ * - `uri`, `uri-reference`, `uri-template`, `url`: URLs
31
+ * - `iri`, `iri-reference`: Internationalized URLs
32
+ * - `uuid`: UUID strings
33
+ * - `ipv4`, `ipv6`: IP addresses
34
+ * - `date-time`, `date`, `time`, `duration`: Date/time formats
35
+ * - `json-pointer`, `relative-json-pointer`: JSON pointers
36
+ * - `regex`: Regular expression patterns
37
+ * - `byte`: Base64-encoded data
38
+ * - `password`: Password fields (for documentation only)
39
+ */
40
+ export type Value =
41
+ | "byte"
42
+ | "password"
43
+ | "regex"
44
+ | "uuid"
45
+ | "email"
46
+ | "hostname"
47
+ | "idn-email"
48
+ | "idn-hostname"
49
+ | "iri"
50
+ | "iri-reference"
51
+ | "ipv4"
52
+ | "ipv6"
53
+ | "uri"
54
+ | "uri-reference"
55
+ | "uri-template"
56
+ | "url"
57
+ | "date-time"
58
+ | "date"
59
+ | "time"
60
+ | "duration"
61
+ | "json-pointer"
62
+ | "relative-json-pointer";
63
+ }
64
+
65
+ type PascalizeString<Key extends string> = Key extends `-${infer R}`
66
+ ? `${PascalizeString<R>}`
67
+ : Key extends `${infer _F}-${infer _R}`
68
+ ? PascalizeSnakeString<Key>
69
+ : Capitalize<Key>;
70
+ type PascalizeSnakeString<Key extends string> = Key extends `-${infer R}`
71
+ ? PascalizeSnakeString<R>
72
+ : Key extends `${infer F}${infer M}-${infer R}`
73
+ ? `${Uppercase<F>}${Lowercase<M>}${PascalizeSnakeString<R>}`
74
+ : Key extends `${infer F}${infer R}`
75
+ ? `${Uppercase<F>}${Lowercase<R>}`
76
+ : Key;