@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,84 +1,84 @@
1
- /**
2
- * Result type for operations that can either succeed or fail.
3
- *
4
- * `IResult` is a discriminated union representing the outcome of an operation
5
- * that may fail. This pattern (often called "Result" or "Either" monad) enables
6
- * explicit error handling without exceptions.
7
- *
8
- * Check the {@link IResult.success | success} discriminator to determine the
9
- * outcome:
10
- *
11
- * - `true` → {@link IResult.ISuccess} with the result in
12
- * {@link IResult.ISuccess.value | value}
13
- * - `false` → {@link IResult.IFailure} with the error in
14
- * {@link IResult.IFailure.error | error}
15
- *
16
- * This pattern is used throughout typia for safe operations like parsing and
17
- * transformation where errors are expected possibilities.
18
- *
19
- * @author Jeongho Nam - https://github.com/samchon
20
- * @example
21
- * const result: IResult<User, ParseError> = parseUser(json);
22
- * if (result.success) {
23
- * console.log(result.value.name);
24
- * } else {
25
- * console.error(result.error.message);
26
- * }
27
- *
28
- * @template T Type of the success value
29
- * @template E Type of the error value
30
- */
31
- export type IResult<T, E> = IResult.ISuccess<T> | IResult.IFailure<E>;
32
- export namespace IResult {
33
- /**
34
- * Successful result variant.
35
- *
36
- * Indicates the operation completed successfully and contains the result
37
- * value. Access via {@link value} after checking {@link success} is `true`.
38
- *
39
- * @template T Type of the success value
40
- */
41
- export interface ISuccess<T> {
42
- /**
43
- * Success discriminator.
44
- *
45
- * Always `true` for successful results. Use this to narrow the type before
46
- * accessing {@link value}.
47
- */
48
- success: true;
49
-
50
- /**
51
- * The successful result value.
52
- *
53
- * Contains the operation's output. Only accessible when {@link success} is
54
- * `true`.
55
- */
56
- value: T;
57
- }
58
-
59
- /**
60
- * Failed result variant.
61
- *
62
- * Indicates the operation failed and contains error information. Access via
63
- * {@link error} after checking {@link success} is `false`.
64
- *
65
- * @template E Type of the error value
66
- */
67
- export interface IFailure<E> {
68
- /**
69
- * Success discriminator.
70
- *
71
- * Always `false` for failed results. Use this to narrow the type before
72
- * accessing {@link error}.
73
- */
74
- success: false;
75
-
76
- /**
77
- * The error information.
78
- *
79
- * Contains details about why the operation failed. Only accessible when
80
- * {@link success} is `false`.
81
- */
82
- error: E;
83
- }
84
- }
1
+ /**
2
+ * Result type for operations that can either succeed or fail.
3
+ *
4
+ * `IResult` is a discriminated union representing the outcome of an operation
5
+ * that may fail. This pattern (often called "Result" or "Either" monad) enables
6
+ * explicit error handling without exceptions.
7
+ *
8
+ * Check the {@link IResult.success | success} discriminator to determine the
9
+ * outcome:
10
+ *
11
+ * - `true` → {@link IResult.ISuccess} with the result in
12
+ * {@link IResult.ISuccess.value | value}
13
+ * - `false` → {@link IResult.IFailure} with the error in
14
+ * {@link IResult.IFailure.error | error}
15
+ *
16
+ * This pattern is used throughout typia for safe operations like parsing and
17
+ * transformation where errors are expected possibilities.
18
+ *
19
+ * @author Jeongho Nam - https://github.com/samchon
20
+ * @example
21
+ * const result: IResult<User, ParseError> = parseUser(json);
22
+ * if (result.success) {
23
+ * console.log(result.value.name);
24
+ * } else {
25
+ * console.error(result.error.message);
26
+ * }
27
+ *
28
+ * @template T Type of the success value
29
+ * @template E Type of the error value
30
+ */
31
+ export type IResult<T, E> = IResult.ISuccess<T> | IResult.IFailure<E>;
32
+ export namespace IResult {
33
+ /**
34
+ * Successful result variant.
35
+ *
36
+ * Indicates the operation completed successfully and contains the result
37
+ * value. Access via {@link value} after checking {@link success} is `true`.
38
+ *
39
+ * @template T Type of the success value
40
+ */
41
+ export interface ISuccess<T> {
42
+ /**
43
+ * Success discriminator.
44
+ *
45
+ * Always `true` for successful results. Use this to narrow the type before
46
+ * accessing {@link value}.
47
+ */
48
+ success: true;
49
+
50
+ /**
51
+ * The successful result value.
52
+ *
53
+ * Contains the operation's output. Only accessible when {@link success} is
54
+ * `true`.
55
+ */
56
+ value: T;
57
+ }
58
+
59
+ /**
60
+ * Failed result variant.
61
+ *
62
+ * Indicates the operation failed and contains error information. Access via
63
+ * {@link error} after checking {@link success} is `false`.
64
+ *
65
+ * @template E Type of the error value
66
+ */
67
+ export interface IFailure<E> {
68
+ /**
69
+ * Success discriminator.
70
+ *
71
+ * Always `false` for failed results. Use this to narrow the type before
72
+ * accessing {@link error}.
73
+ */
74
+ success: false;
75
+
76
+ /**
77
+ * The error information.
78
+ *
79
+ * Contains details about why the operation failed. Only accessible when
80
+ * {@link success} is `false`.
81
+ */
82
+ error: E;
83
+ }
84
+ }
@@ -1,134 +1,134 @@
1
- /**
2
- * Validation result type with detailed error information.
3
- *
4
- * `IValidation<T>` is the return type of `typia.validate<T>()` and related
5
- * validation functions. Unlike `typia.is<T>()` which returns a boolean, or
6
- * `typia.assert<T>()` which throws exceptions, `typia.validate<T>()` returns
7
- * this structured result with full error details.
8
- *
9
- * Check the {@link IValidation.success | success} discriminator:
10
- *
11
- * - `true` → {@link IValidation.ISuccess} with validated
12
- * {@link IValidation.ISuccess.data | data}
13
- * - `false` → {@link IValidation.IFailure} with
14
- * {@link IValidation.IFailure.errors | errors} array
15
- *
16
- * This is the recommended validation function when you need to report
17
- * validation errors to users or log them for debugging.
18
- *
19
- * @author Jeongho Nam - https://github.com/samchon
20
- * @example
21
- * const result = typia.validate<User>(input);
22
- * if (result.success) {
23
- * return result.data; // User type
24
- * } else {
25
- * result.errors.forEach((e) => console.log(e.path, e.expected));
26
- * }
27
- *
28
- * @template T The expected type after successful validation
29
- */
30
- export type IValidation<T = unknown> =
31
- | IValidation.ISuccess<T>
32
- | IValidation.IFailure;
33
-
34
- export namespace IValidation {
35
- /**
36
- * Successful validation result.
37
- *
38
- * Indicates the input matches the expected type. The validated data is
39
- * available in {@link data} with full type information.
40
- *
41
- * @template T The validated type
42
- */
43
- export interface ISuccess<T = unknown> {
44
- /**
45
- * Success discriminator.
46
- *
47
- * Always `true` for successful validations. Use this to narrow the type
48
- * before accessing {@link data}.
49
- */
50
- success: true;
51
-
52
- /**
53
- * The validated data with correct type.
54
- *
55
- * The original input after successful validation. TypeScript will narrow
56
- * this to type `T` when {@link success} is `true`.
57
- */
58
- data: T;
59
- }
60
-
61
- /**
62
- * Failed validation result with error details.
63
- *
64
- * Indicates the input did not match the expected type. Contains the original
65
- * data and an array of all validation errors found.
66
- */
67
- export interface IFailure {
68
- /**
69
- * Success discriminator.
70
- *
71
- * Always `false` for failed validations. Use this to narrow the type before
72
- * accessing {@link errors}.
73
- */
74
- success: false;
75
-
76
- /**
77
- * The original input that failed validation.
78
- *
79
- * Preserved as `unknown` type since it didn't match the expected type.
80
- * Useful for debugging or logging the actual value.
81
- */
82
- data: unknown;
83
-
84
- /**
85
- * Array of validation errors.
86
- *
87
- * Contains one entry for each validation failure found. Multiple errors may
88
- * exist if the input has multiple type mismatches.
89
- */
90
- errors: IError[];
91
- }
92
-
93
- /**
94
- * Detailed information about a single validation error.
95
- *
96
- * Describes exactly what went wrong during validation, including the
97
- * location, expected type, and actual value.
98
- */
99
- export interface IError {
100
- /**
101
- * Property path to the error location.
102
- *
103
- * A dot-notation path from the root input to the failing property. Uses
104
- * `$input` as the root. Example: `"$input.user.email"` or
105
- * `"$input.items[0].price"`.
106
- */
107
- path: string;
108
-
109
- /**
110
- * Expected type expression.
111
- *
112
- * A human-readable description of what type was expected at this location.
113
- * Examples: `"string"`, `"number & ExclusiveMinimum<0>"`, `"(\"active\" |
114
- * \"inactive\")"`.
115
- */
116
- expected: string;
117
-
118
- /**
119
- * The actual value that failed validation.
120
- *
121
- * The value found at the error path. May be `undefined` if the property was
122
- * missing. Useful for debugging type mismatches.
123
- */
124
- value: unknown;
125
-
126
- /**
127
- * Human-readable error description.
128
- *
129
- * Optional additional context about the validation failure, such as
130
- * constraint violations or custom error messages.
131
- */
132
- description?: string;
133
- }
134
- }
1
+ /**
2
+ * Validation result type with detailed error information.
3
+ *
4
+ * `IValidation<T>` is the return type of `typia.validate<T>()` and related
5
+ * validation functions. Unlike `typia.is<T>()` which returns a boolean, or
6
+ * `typia.assert<T>()` which throws exceptions, `typia.validate<T>()` returns
7
+ * this structured result with full error details.
8
+ *
9
+ * Check the {@link IValidation.success | success} discriminator:
10
+ *
11
+ * - `true` → {@link IValidation.ISuccess} with validated
12
+ * {@link IValidation.ISuccess.data | data}
13
+ * - `false` → {@link IValidation.IFailure} with
14
+ * {@link IValidation.IFailure.errors | errors} array
15
+ *
16
+ * This is the recommended validation function when you need to report
17
+ * validation errors to users or log them for debugging.
18
+ *
19
+ * @author Jeongho Nam - https://github.com/samchon
20
+ * @example
21
+ * const result = typia.validate<User>(input);
22
+ * if (result.success) {
23
+ * return result.data; // User type
24
+ * } else {
25
+ * result.errors.forEach((e) => console.log(e.path, e.expected));
26
+ * }
27
+ *
28
+ * @template T The expected type after successful validation
29
+ */
30
+ export type IValidation<T = unknown> =
31
+ | IValidation.ISuccess<T>
32
+ | IValidation.IFailure;
33
+
34
+ export namespace IValidation {
35
+ /**
36
+ * Successful validation result.
37
+ *
38
+ * Indicates the input matches the expected type. The validated data is
39
+ * available in {@link data} with full type information.
40
+ *
41
+ * @template T The validated type
42
+ */
43
+ export interface ISuccess<T = unknown> {
44
+ /**
45
+ * Success discriminator.
46
+ *
47
+ * Always `true` for successful validations. Use this to narrow the type
48
+ * before accessing {@link data}.
49
+ */
50
+ success: true;
51
+
52
+ /**
53
+ * The validated data with correct type.
54
+ *
55
+ * The original input after successful validation. TypeScript will narrow
56
+ * this to type `T` when {@link success} is `true`.
57
+ */
58
+ data: T;
59
+ }
60
+
61
+ /**
62
+ * Failed validation result with error details.
63
+ *
64
+ * Indicates the input did not match the expected type. Contains the original
65
+ * data and an array of all validation errors found.
66
+ */
67
+ export interface IFailure {
68
+ /**
69
+ * Success discriminator.
70
+ *
71
+ * Always `false` for failed validations. Use this to narrow the type before
72
+ * accessing {@link errors}.
73
+ */
74
+ success: false;
75
+
76
+ /**
77
+ * The original input that failed validation.
78
+ *
79
+ * Preserved as `unknown` type since it didn't match the expected type.
80
+ * Useful for debugging or logging the actual value.
81
+ */
82
+ data: unknown;
83
+
84
+ /**
85
+ * Array of validation errors.
86
+ *
87
+ * Contains one entry for each validation failure found. Multiple errors may
88
+ * exist if the input has multiple type mismatches.
89
+ */
90
+ errors: IError[];
91
+ }
92
+
93
+ /**
94
+ * Detailed information about a single validation error.
95
+ *
96
+ * Describes exactly what went wrong during validation, including the
97
+ * location, expected type, and actual value.
98
+ */
99
+ export interface IError {
100
+ /**
101
+ * Property path to the error location.
102
+ *
103
+ * A dot-notation path from the root input to the failing property. Uses
104
+ * `$input` as the root. Example: `"$input.user.email"` or
105
+ * `"$input.items[0].price"`.
106
+ */
107
+ path: string;
108
+
109
+ /**
110
+ * Expected type expression.
111
+ *
112
+ * A human-readable description of what type was expected at this location.
113
+ * Examples: `"string"`, `"number & ExclusiveMinimum<0>"`, `"(\"active\" |
114
+ * \"inactive\")"`.
115
+ */
116
+ expected: string;
117
+
118
+ /**
119
+ * The actual value that failed validation.
120
+ *
121
+ * The value found at the error path. May be `undefined` if the property was
122
+ * missing. Useful for debugging type mismatches.
123
+ */
124
+ value: unknown;
125
+
126
+ /**
127
+ * Human-readable error description.
128
+ *
129
+ * Optional additional context about the validation failure, such as
130
+ * constraint violations or custom error messages.
131
+ */
132
+ description?: string;
133
+ }
134
+ }
@@ -1,14 +1,14 @@
1
- export * from "./IResult";
2
- export * from "./IValidation";
3
-
4
- export * from "./IJsonSchemaTransformError";
5
- export * from "./IJsonSchemaApplication";
6
- export * from "./IJsonSchemaCollection";
7
- export * from "./IJsonSchemaUnit";
8
- export * from "./IJsonSchemaAttribute";
9
-
10
- export * from "./ILlmController";
11
- export * from "./ILlmApplication";
12
- export * from "./ILlmFunction";
13
- export * from "./ILlmSchema";
14
- export * from "./IJsonParseResult";
1
+ export * from "./IResult";
2
+ export * from "./IValidation";
3
+
4
+ export * from "./IJsonSchemaTransformError";
5
+ export * from "./IJsonSchemaApplication";
6
+ export * from "./IJsonSchemaCollection";
7
+ export * from "./IJsonSchemaUnit";
8
+ export * from "./IJsonSchemaAttribute";
9
+
10
+ export * from "./ILlmController";
11
+ export * from "./ILlmApplication";
12
+ export * from "./ILlmFunction";
13
+ export * from "./ILlmSchema";
14
+ export * from "./IJsonParseResult";
@@ -1,49 +1,49 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Documentation metadata for literal/constant values.
5
- *
6
- * `Constant<Value, Content>` enhances literal type values with human-readable
7
- * documentation that appears in generated JSON Schema output. This is useful
8
- * for enum-like values where each literal needs individual documentation.
9
- *
10
- * Unlike TypeScript enums which lose their documentation in schema generation,
11
- * `Constant` preserves title and description for each value. This helps API
12
- * consumers understand the meaning of each allowed value.
13
- *
14
- * The tag itself doesn't perform validation - it only adds metadata. The
15
- * literal type constraint is enforced by TypeScript's type system.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- * @example
19
- * type OrderStatus =
20
- * | Constant<
21
- * "pending",
22
- * { title: "Pending"; description: "Order placed" }
23
- * >
24
- * | Constant<"shipped", { title: "Shipped"; description: "In transit" }>
25
- * | Constant<
26
- * "delivered",
27
- * { title: "Delivered"; description: "Complete" }
28
- * >;
29
- *
30
- * interface Order {
31
- * status: OrderStatus;
32
- * }
33
- *
34
- * @template Value The literal value (boolean, number, string, or bigint)
35
- * @template Content Object with optional `title` and `description` properties
36
- */
37
- export type Constant<
38
- Value extends boolean | number | string | bigint,
39
- Content extends {
40
- title?: string | undefined;
41
- description?: string | undefined;
42
- },
43
- > = Value &
44
- TagBase<{
45
- target: "string" | "boolean" | "number" | "bigint";
46
- kind: "constant";
47
- value: undefined;
48
- schema: Content;
49
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Documentation metadata for literal/constant values.
5
+ *
6
+ * `Constant<Value, Content>` enhances literal type values with human-readable
7
+ * documentation that appears in generated JSON Schema output. This is useful
8
+ * for enum-like values where each literal needs individual documentation.
9
+ *
10
+ * Unlike TypeScript enums which lose their documentation in schema generation,
11
+ * `Constant` preserves title and description for each value. This helps API
12
+ * consumers understand the meaning of each allowed value.
13
+ *
14
+ * The tag itself doesn't perform validation - it only adds metadata. The
15
+ * literal type constraint is enforced by TypeScript's type system.
16
+ *
17
+ * @author Jeongho Nam - https://github.com/samchon
18
+ * @example
19
+ * type OrderStatus =
20
+ * | Constant<
21
+ * "pending",
22
+ * { title: "Pending"; description: "Order placed" }
23
+ * >
24
+ * | Constant<"shipped", { title: "Shipped"; description: "In transit" }>
25
+ * | Constant<
26
+ * "delivered",
27
+ * { title: "Delivered"; description: "Complete" }
28
+ * >;
29
+ *
30
+ * interface Order {
31
+ * status: OrderStatus;
32
+ * }
33
+ *
34
+ * @template Value The literal value (boolean, number, string, or bigint)
35
+ * @template Content Object with optional `title` and `description` properties
36
+ */
37
+ export type Constant<
38
+ Value extends boolean | number | string | bigint,
39
+ Content extends {
40
+ title?: string | undefined;
41
+ description?: string | undefined;
42
+ },
43
+ > = Value &
44
+ TagBase<{
45
+ target: "string" | "boolean" | "number" | "bigint";
46
+ kind: "constant";
47
+ value: undefined;
48
+ schema: Content;
49
+ }>;
@@ -1,40 +1,40 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * MIME type metadata for string content.
5
- *
6
- * `ContentMediaType<Type>` is a type tag that documents the media type of
7
- * string content. This is metadata-only - no runtime validation is performed.
8
- * The information appears in generated JSON Schema output.
9
- *
10
- * This is useful when a string property contains encoded binary data or
11
- * structured content that should be interpreted according to a specific media
12
- * type, such as base64-encoded images or embedded JSON.
13
- *
14
- * Common MIME types:
15
- *
16
- * - `"application/json"`: JSON data as string
17
- * - `"application/xml"`: XML data as string
18
- * - `"image/png"`: Base64-encoded PNG image
19
- * - `"image/jpeg"`: Base64-encoded JPEG image
20
- * - `"application/octet-stream"`: Generic binary data
21
- *
22
- * @author Jeongho Nam - https://github.com/samchon
23
- * @example
24
- * interface Document {
25
- * // Base64-encoded PNG image
26
- * thumbnail: string & ContentMediaType<"image/png">;
27
- * // JSON stored as string
28
- * metadata: string & ContentMediaType<"application/json">;
29
- * }
30
- *
31
- * @template Value MIME type string literal
32
- */
33
- export type ContentMediaType<Value extends string> = TagBase<{
34
- target: "string";
35
- kind: "contentMediaType";
36
- value: undefined;
37
- schema: {
38
- contentMediaType: Value;
39
- };
40
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * MIME type metadata for string content.
5
+ *
6
+ * `ContentMediaType<Type>` is a type tag that documents the media type of
7
+ * string content. This is metadata-only - no runtime validation is performed.
8
+ * The information appears in generated JSON Schema output.
9
+ *
10
+ * This is useful when a string property contains encoded binary data or
11
+ * structured content that should be interpreted according to a specific media
12
+ * type, such as base64-encoded images or embedded JSON.
13
+ *
14
+ * Common MIME types:
15
+ *
16
+ * - `"application/json"`: JSON data as string
17
+ * - `"application/xml"`: XML data as string
18
+ * - `"image/png"`: Base64-encoded PNG image
19
+ * - `"image/jpeg"`: Base64-encoded JPEG image
20
+ * - `"application/octet-stream"`: Generic binary data
21
+ *
22
+ * @author Jeongho Nam - https://github.com/samchon
23
+ * @example
24
+ * interface Document {
25
+ * // Base64-encoded PNG image
26
+ * thumbnail: string & ContentMediaType<"image/png">;
27
+ * // JSON stored as string
28
+ * metadata: string & ContentMediaType<"application/json">;
29
+ * }
30
+ *
31
+ * @template Value MIME type string literal
32
+ */
33
+ export type ContentMediaType<Value extends string> = TagBase<{
34
+ target: "string";
35
+ kind: "contentMediaType";
36
+ value: undefined;
37
+ schema: {
38
+ contentMediaType: Value;
39
+ };
40
+ }>;