@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,45 +1,45 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Injects custom properties into generated JSON Schema.
5
- *
6
- * `JsonSchemaPlugin<Schema>` is a type tag that merges custom properties into
7
- * the generated JSON Schema output. This enables vendor extensions (typically
8
- * prefixed with `x-`) and custom metadata that tools in your ecosystem may
9
- * require.
10
- *
11
- * This is metadata-only - it does not affect runtime validation. The properties
12
- * are simply merged into the schema for the annotated type.
13
- *
14
- * Common use cases:
15
- *
16
- * - OpenAPI vendor extensions (`x-*` properties)
17
- * - Custom UI hints for form generators
18
- * - Tool-specific metadata
19
- * - Integration with third-party schema consumers
20
- *
21
- * @author Jeongho Nam - https://github.com/samchon
22
- * @example
23
- * interface FormField {
24
- * // Add custom UI hints for form generation
25
- * email: string &
26
- * Format<"email"> &
27
- * JsonSchemaPlugin<{
28
- * "x-ui-widget": "email-input";
29
- * "x-ui-placeholder": "Enter your email";
30
- * }>;
31
- * // Add custom sorting metadata
32
- * priority: number &
33
- * JsonSchemaPlugin<{
34
- * "x-sort-order": "descending";
35
- * }>;
36
- * }
37
- *
38
- * @template Schema Object type containing the custom properties to merge
39
- */
40
- export type JsonSchemaPlugin<Schema extends object> = TagBase<{
41
- target: "string" | "boolean" | "bigint" | "number" | "array" | "object";
42
- kind: "jsonPlugin";
43
- value: undefined;
44
- schema: Schema;
45
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Injects custom properties into generated JSON Schema.
5
+ *
6
+ * `JsonSchemaPlugin<Schema>` is a type tag that merges custom properties into
7
+ * the generated JSON Schema output. This enables vendor extensions (typically
8
+ * prefixed with `x-`) and custom metadata that tools in your ecosystem may
9
+ * require.
10
+ *
11
+ * This is metadata-only - it does not affect runtime validation. The properties
12
+ * are simply merged into the schema for the annotated type.
13
+ *
14
+ * Common use cases:
15
+ *
16
+ * - OpenAPI vendor extensions (`x-*` properties)
17
+ * - Custom UI hints for form generators
18
+ * - Tool-specific metadata
19
+ * - Integration with third-party schema consumers
20
+ *
21
+ * @author Jeongho Nam - https://github.com/samchon
22
+ * @example
23
+ * interface FormField {
24
+ * // Add custom UI hints for form generation
25
+ * email: string &
26
+ * Format<"email"> &
27
+ * JsonSchemaPlugin<{
28
+ * "x-ui-widget": "email-input";
29
+ * "x-ui-placeholder": "Enter your email";
30
+ * }>;
31
+ * // Add custom sorting metadata
32
+ * priority: number &
33
+ * JsonSchemaPlugin<{
34
+ * "x-sort-order": "descending";
35
+ * }>;
36
+ * }
37
+ *
38
+ * @template Schema Object type containing the custom properties to merge
39
+ */
40
+ export type JsonSchemaPlugin<Schema extends object> = TagBase<{
41
+ target: "string" | "boolean" | "bigint" | "number" | "array" | "object";
42
+ kind: "jsonPlugin";
43
+ value: undefined;
44
+ schema: Schema;
45
+ }>;
@@ -1,39 +1,39 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Array maximum items constraint.
5
- *
6
- * `MaxItems<N>` is a type tag that validates array values have at most the
7
- * specified number of elements. Apply it to array properties using TypeScript
8
- * intersection types.
9
- *
10
- * This constraint is commonly combined with {@link MinItems} to define a valid
11
- * size range. It can also be combined with {@link UniqueItems} to require unique
12
- * elements.
13
- *
14
- * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
- * `typia.validate()`. It generates `maxItems` in JSON Schema output.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * interface Upload {
20
- * // Maximum 5 files per upload
21
- * files: (File & MaxItems<5>)[];
22
- * }
23
- * interface Config {
24
- * // Between 1-3 backup servers allowed
25
- * backupServers: (Server & MinItems<1> & MaxItems<3>)[];
26
- * }
27
- *
28
- * @template Value Maximum number of elements allowed
29
- */
30
- export type MaxItems<Value extends number> = TagBase<{
31
- target: "array";
32
- kind: "maxItems";
33
- value: Value;
34
- validate: `$input.length <= ${Value}`;
35
- exclusive: true;
36
- schema: {
37
- maxItems: Value;
38
- };
39
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Array maximum items constraint.
5
+ *
6
+ * `MaxItems<N>` is a type tag that validates array values have at most the
7
+ * specified number of elements. Apply it to array properties using TypeScript
8
+ * intersection types.
9
+ *
10
+ * This constraint is commonly combined with {@link MinItems} to define a valid
11
+ * size range. It can also be combined with {@link UniqueItems} to require unique
12
+ * elements.
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It generates `maxItems` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Upload {
20
+ * // Maximum 5 files per upload
21
+ * files: (File & MaxItems<5>)[];
22
+ * }
23
+ * interface Config {
24
+ * // Between 1-3 backup servers allowed
25
+ * backupServers: (Server & MinItems<1> & MaxItems<3>)[];
26
+ * }
27
+ *
28
+ * @template Value Maximum number of elements allowed
29
+ */
30
+ export type MaxItems<Value extends number> = TagBase<{
31
+ target: "array";
32
+ kind: "maxItems";
33
+ value: Value;
34
+ validate: `$input.length <= ${Value}`;
35
+ exclusive: true;
36
+ schema: {
37
+ maxItems: Value;
38
+ };
39
+ }>;
@@ -1,37 +1,37 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * String maximum length constraint.
5
- *
6
- * `MaxLength<N>` is a type tag that validates string values have at most the
7
- * specified number of characters. Apply it to `string` properties using
8
- * TypeScript intersection types.
9
- *
10
- * This constraint is commonly combined with {@link MinLength} to define a valid
11
- * length range. Multiple length constraints can be applied to the same property
12
- * (all must pass).
13
- *
14
- * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
- * `typia.validate()`. It generates `maxLength` in JSON Schema output.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * interface Article {
20
- * // Title limited to 100 characters
21
- * title: string & MaxLength<100>;
22
- * // Description between 10-500 characters
23
- * description: string & MinLength<10> & MaxLength<500>;
24
- * }
25
- *
26
- * @template Value Maximum number of characters allowed
27
- */
28
- export type MaxLength<Value extends number> = TagBase<{
29
- target: "string";
30
- kind: "maxLength";
31
- value: Value;
32
- validate: `$input.length <= ${Value}`;
33
- exclusive: true;
34
- schema: {
35
- maxLength: Value;
36
- };
37
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * String maximum length constraint.
5
+ *
6
+ * `MaxLength<N>` is a type tag that validates string values have at most the
7
+ * specified number of characters. Apply it to `string` properties using
8
+ * TypeScript intersection types.
9
+ *
10
+ * This constraint is commonly combined with {@link MinLength} to define a valid
11
+ * length range. Multiple length constraints can be applied to the same property
12
+ * (all must pass).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It generates `maxLength` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Article {
20
+ * // Title limited to 100 characters
21
+ * title: string & MaxLength<100>;
22
+ * // Description between 10-500 characters
23
+ * description: string & MinLength<10> & MaxLength<500>;
24
+ * }
25
+ *
26
+ * @template Value Maximum number of characters allowed
27
+ */
28
+ export type MaxLength<Value extends number> = TagBase<{
29
+ target: "string";
30
+ kind: "maxLength";
31
+ value: Value;
32
+ validate: `$input.length <= ${Value}`;
33
+ exclusive: true;
34
+ schema: {
35
+ maxLength: Value;
36
+ };
37
+ }>;
@@ -1,44 +1,44 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Inclusive maximum value constraint (value <= max).
5
- *
6
- * `Maximum<N>` is a type tag that validates numeric values are less than or
7
- * equal to the specified bound. Apply it to `number` or `bigint` properties
8
- * using TypeScript intersection types.
9
- *
10
- * This constraint is **mutually exclusive** with {@link ExclusiveMaximum} - you
11
- * cannot use both on the same property. Use `Maximum` for inclusive bounds (<=)
12
- * and `ExclusiveMaximum` for exclusive bounds (<).
13
- *
14
- * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
- * `typia.validate()`. It also generates `maximum` in JSON Schema output.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * interface Rating {
20
- * // Score from 0-100
21
- * score: number & Minimum<0> & Maximum<100>;
22
- * // Percentage cannot exceed 1.0
23
- * ratio: number & Maximum<1.0>;
24
- * }
25
- *
26
- * @template Value The maximum allowed value (inclusive)
27
- */
28
- export type Maximum<Value extends number | bigint> = TagBase<{
29
- target: Value extends bigint ? "bigint" : "number";
30
- kind: "maximum";
31
- value: Value;
32
- validate: `$input <= ${Cast<Value>}`;
33
- exclusive: ["maximum", "exclusiveMaximum"];
34
- schema: Value extends bigint
35
- ? { maximum: Numeric<Value> }
36
- : { maximum: Value };
37
- }>;
38
-
39
- type Cast<Value extends number | bigint> = Value extends number
40
- ? Value
41
- : `BigInt(${Value})`;
42
- type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
43
- ? N
44
- : never;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Inclusive maximum value constraint (value <= max).
5
+ *
6
+ * `Maximum<N>` is a type tag that validates numeric values are less than or
7
+ * equal to the specified bound. Apply it to `number` or `bigint` properties
8
+ * using TypeScript intersection types.
9
+ *
10
+ * This constraint is **mutually exclusive** with {@link ExclusiveMaximum} - you
11
+ * cannot use both on the same property. Use `Maximum` for inclusive bounds (<=)
12
+ * and `ExclusiveMaximum` for exclusive bounds (<).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It also generates `maximum` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Rating {
20
+ * // Score from 0-100
21
+ * score: number & Minimum<0> & Maximum<100>;
22
+ * // Percentage cannot exceed 1.0
23
+ * ratio: number & Maximum<1.0>;
24
+ * }
25
+ *
26
+ * @template Value The maximum allowed value (inclusive)
27
+ */
28
+ export type Maximum<Value extends number | bigint> = TagBase<{
29
+ target: Value extends bigint ? "bigint" : "number";
30
+ kind: "maximum";
31
+ value: Value;
32
+ validate: `$input <= ${Cast<Value>}`;
33
+ exclusive: ["maximum", "exclusiveMaximum"];
34
+ schema: Value extends bigint
35
+ ? { maximum: Numeric<Value> }
36
+ : { maximum: Value };
37
+ }>;
38
+
39
+ type Cast<Value extends number | bigint> = Value extends number
40
+ ? Value
41
+ : `BigInt(${Value})`;
42
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
43
+ ? N
44
+ : never;
@@ -1,39 +1,39 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Array minimum items constraint.
5
- *
6
- * `MinItems<N>` is a type tag that validates array values have at least the
7
- * specified number of elements. Apply it to array properties using TypeScript
8
- * intersection types.
9
- *
10
- * This constraint is commonly combined with {@link MaxItems} to define a valid
11
- * size range. It can also be combined with {@link UniqueItems} to require unique
12
- * elements.
13
- *
14
- * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
- * `typia.validate()`. It generates `minItems` in JSON Schema output.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * interface Order {
20
- * // Must have at least 1 item
21
- * items: (Product & MinItems<1>)[];
22
- * }
23
- * interface Team {
24
- * // Team must have 2-10 members
25
- * members: (User & MinItems<2> & MaxItems<10>)[];
26
- * }
27
- *
28
- * @template Value Minimum number of elements required
29
- */
30
- export type MinItems<Value extends number> = TagBase<{
31
- target: "array";
32
- kind: "minItems";
33
- value: Value;
34
- validate: `${Value} <= $input.length`;
35
- exclusive: true;
36
- schema: {
37
- minItems: Value;
38
- };
39
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Array minimum items constraint.
5
+ *
6
+ * `MinItems<N>` is a type tag that validates array values have at least the
7
+ * specified number of elements. Apply it to array properties using TypeScript
8
+ * intersection types.
9
+ *
10
+ * This constraint is commonly combined with {@link MaxItems} to define a valid
11
+ * size range. It can also be combined with {@link UniqueItems} to require unique
12
+ * elements.
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It generates `minItems` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Order {
20
+ * // Must have at least 1 item
21
+ * items: (Product & MinItems<1>)[];
22
+ * }
23
+ * interface Team {
24
+ * // Team must have 2-10 members
25
+ * members: (User & MinItems<2> & MaxItems<10>)[];
26
+ * }
27
+ *
28
+ * @template Value Minimum number of elements required
29
+ */
30
+ export type MinItems<Value extends number> = TagBase<{
31
+ target: "array";
32
+ kind: "minItems";
33
+ value: Value;
34
+ validate: `${Value} <= $input.length`;
35
+ exclusive: true;
36
+ schema: {
37
+ minItems: Value;
38
+ };
39
+ }>;
@@ -1,37 +1,37 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * String minimum length constraint.
5
- *
6
- * `MinLength<N>` is a type tag that validates string values have at least the
7
- * specified number of characters. Apply it to `string` properties using
8
- * TypeScript intersection types.
9
- *
10
- * This constraint is commonly combined with {@link MaxLength} to define a valid
11
- * length range. Multiple length constraints can be applied to the same property
12
- * (all must pass).
13
- *
14
- * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
- * `typia.validate()`. It generates `minLength` in JSON Schema output.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * interface User {
20
- * // Username must be at least 3 characters
21
- * username: string & MinLength<3> & MaxLength<20>;
22
- * // Password must be at least 8 characters
23
- * password: string & MinLength<8>;
24
- * }
25
- *
26
- * @template Value Minimum number of characters required
27
- */
28
- export type MinLength<Value extends number> = TagBase<{
29
- target: "string";
30
- kind: "minLength";
31
- value: Value;
32
- validate: `${Value} <= $input.length`;
33
- exclusive: true;
34
- schema: {
35
- minLength: Value;
36
- };
37
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * String minimum length constraint.
5
+ *
6
+ * `MinLength<N>` is a type tag that validates string values have at least the
7
+ * specified number of characters. Apply it to `string` properties using
8
+ * TypeScript intersection types.
9
+ *
10
+ * This constraint is commonly combined with {@link MaxLength} to define a valid
11
+ * length range. Multiple length constraints can be applied to the same property
12
+ * (all must pass).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It generates `minLength` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface User {
20
+ * // Username must be at least 3 characters
21
+ * username: string & MinLength<3> & MaxLength<20>;
22
+ * // Password must be at least 8 characters
23
+ * password: string & MinLength<8>;
24
+ * }
25
+ *
26
+ * @template Value Minimum number of characters required
27
+ */
28
+ export type MinLength<Value extends number> = TagBase<{
29
+ target: "string";
30
+ kind: "minLength";
31
+ value: Value;
32
+ validate: `${Value} <= $input.length`;
33
+ exclusive: true;
34
+ schema: {
35
+ minLength: Value;
36
+ };
37
+ }>;
@@ -1,44 +1,44 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Inclusive minimum value constraint (value >= min).
5
- *
6
- * `Minimum<N>` is a type tag that validates numeric values are greater than or
7
- * equal to the specified bound. Apply it to `number` or `bigint` properties
8
- * using TypeScript intersection types.
9
- *
10
- * This constraint is **mutually exclusive** with {@link ExclusiveMinimum} - you
11
- * cannot use both on the same property. Use `Minimum` for inclusive bounds (>=)
12
- * and `ExclusiveMinimum` for exclusive bounds (>).
13
- *
14
- * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
- * `typia.validate()`. It also generates `minimum` in JSON Schema output.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * interface Product {
20
- * // Price must be 0 or greater
21
- * price: number & Minimum<0>;
22
- * // Quantity must be at least 1
23
- * quantity: number & Minimum<1>;
24
- * }
25
- *
26
- * @template Value The minimum allowed value (inclusive)
27
- */
28
- export type Minimum<Value extends number | bigint> = TagBase<{
29
- target: Value extends bigint ? "bigint" : "number";
30
- kind: "minimum";
31
- value: Value;
32
- validate: `${Cast<Value>} <= $input`;
33
- exclusive: ["minimum", "exclusiveMinimum"];
34
- schema: Value extends bigint
35
- ? { minimum: Numeric<Value> }
36
- : { minimum: Value };
37
- }>;
38
-
39
- type Cast<Value extends number | bigint> = Value extends number
40
- ? Value
41
- : `BigInt(${Value})`;
42
- type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
43
- ? N
44
- : never;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Inclusive minimum value constraint (value >= min).
5
+ *
6
+ * `Minimum<N>` is a type tag that validates numeric values are greater than or
7
+ * equal to the specified bound. Apply it to `number` or `bigint` properties
8
+ * using TypeScript intersection types.
9
+ *
10
+ * This constraint is **mutually exclusive** with {@link ExclusiveMinimum} - you
11
+ * cannot use both on the same property. Use `Minimum` for inclusive bounds (>=)
12
+ * and `ExclusiveMinimum` for exclusive bounds (>).
13
+ *
14
+ * The constraint is enforced at runtime by `typia.is()`, `typia.assert()`, and
15
+ * `typia.validate()`. It also generates `minimum` in JSON Schema output.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * interface Product {
20
+ * // Price must be 0 or greater
21
+ * price: number & Minimum<0>;
22
+ * // Quantity must be at least 1
23
+ * quantity: number & Minimum<1>;
24
+ * }
25
+ *
26
+ * @template Value The minimum allowed value (inclusive)
27
+ */
28
+ export type Minimum<Value extends number | bigint> = TagBase<{
29
+ target: Value extends bigint ? "bigint" : "number";
30
+ kind: "minimum";
31
+ value: Value;
32
+ validate: `${Cast<Value>} <= $input`;
33
+ exclusive: ["minimum", "exclusiveMinimum"];
34
+ schema: Value extends bigint
35
+ ? { minimum: Numeric<Value> }
36
+ : { minimum: Value };
37
+ }>;
38
+
39
+ type Cast<Value extends number | bigint> = Value extends number
40
+ ? Value
41
+ : `BigInt(${Value})`;
42
+ type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
43
+ ? N
44
+ : never;