typia 4.0.0 → 4.0.1
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.
- package/lib/programmers/ApplicationProgrammer.js +1 -1
- package/lib/programmers/internal/application_array.js +19 -41
- package/lib/programmers/internal/application_array.js.map +1 -1
- package/lib/programmers/internal/application_definition.d.ts +1 -1
- package/lib/programmers/internal/application_definition.js +8 -8
- package/lib/programmers/internal/application_definition.js.map +1 -1
- package/lib/programmers/internal/application_native.js +3 -3
- package/lib/programmers/internal/application_object.js +4 -4
- package/lib/programmers/internal/application_schema.js +3 -3
- package/lib/programmers/internal/application_schema.js.map +1 -1
- package/lib/programmers/internal/application_tuple.js +8 -30
- package/lib/programmers/internal/application_tuple.js.map +1 -1
- package/lib/schemas/IJsonComponents.d.ts +1 -12
- package/lib/schemas/IJsonSchema.d.ts +1 -1
- package/package.json +1 -1
- package/src/IRandomGenerator.ts +34 -34
- package/src/factories/IdentifierFactory.ts +65 -65
- package/src/factories/MetadataCollection.ts +254 -254
- package/src/factories/MetadataFactory.ts +40 -40
- package/src/factories/MetadataTagFactory.ts +300 -300
- package/src/factories/internal/metadata/emplace_metadata_array.ts +34 -34
- package/src/factories/internal/metadata/emplace_metadata_definition.ts +35 -35
- package/src/factories/internal/metadata/emplace_metadata_object.ts +142 -142
- package/src/factories/internal/metadata/emplace_metadata_tuple.ts +50 -50
- package/src/factories/internal/metadata/explore_metadata.ts +66 -66
- package/src/factories/internal/metadata/iterate_metadata.ts +77 -77
- package/src/factories/internal/metadata/iterate_metadata_array.ts +25 -25
- package/src/factories/internal/metadata/iterate_metadata_collection.ts +130 -130
- package/src/factories/internal/metadata/iterate_metadata_definition.ts +30 -30
- package/src/factories/internal/metadata/iterate_metadata_object.ts +49 -49
- package/src/factories/internal/metadata/iterate_metadata_sort.ts +68 -68
- package/src/factories/internal/metadata/iterate_metadata_tuple.ts +24 -24
- package/src/factories/internal/metadata/iterate_metadata_union.ts +68 -68
- package/src/metadata/IMetadata.ts +27 -27
- package/src/metadata/IMetadataAlias.ts +12 -12
- package/src/metadata/IMetadataApplication.ts +7 -7
- package/src/metadata/IMetadataArray.ts +10 -10
- package/src/metadata/IMetadataCollection.ts +11 -11
- package/src/metadata/IMetadataDictionary.ts +14 -14
- package/src/metadata/IMetadataObject.ts +18 -18
- package/src/metadata/IMetadataProperty.ts +11 -11
- package/src/metadata/IMetadataTuple.ts +10 -10
- package/src/metadata/Metadata.ts +585 -585
- package/src/metadata/MetadataAlias.ts +61 -61
- package/src/metadata/MetadataArray.ts +52 -52
- package/src/metadata/MetadataObject.ts +114 -114
- package/src/metadata/MetadataProperty.ts +64 -64
- package/src/metadata/MetadataTuple.ts +53 -53
- package/src/programmers/ApplicationProgrammer.ts +55 -55
- package/src/programmers/AssertProgrammer.ts +291 -291
- package/src/programmers/CheckerProgrammer.ts +1182 -1182
- package/src/programmers/CloneProgrammer.ts +595 -595
- package/src/programmers/FeatureProgrammer.ts +495 -495
- package/src/programmers/IsProgrammer.ts +250 -250
- package/src/programmers/LiteralsProgrammer.ts +66 -66
- package/src/programmers/PruneProgrammer.ts +550 -550
- package/src/programmers/RandomProgrammer.ts +589 -589
- package/src/programmers/StringifyProgrammer.ts +990 -990
- package/src/programmers/ValidateProgrammer.ts +313 -313
- package/src/programmers/helpers/FunctionImporeter.ts +78 -78
- package/src/programmers/helpers/RandomJoiner.ts +173 -173
- package/src/programmers/helpers/UnionExplorer.ts +301 -301
- package/src/programmers/helpers/UnionPredicator.ts +81 -81
- package/src/programmers/helpers/disable_function_importer_declare.ts +26 -26
- package/src/programmers/internal/JSON_SCHEMA_PREFIX.ts +1 -1
- package/src/programmers/internal/application_array.ts +30 -64
- package/src/programmers/internal/application_boolean.ts +15 -15
- package/src/programmers/internal/application_constant.ts +26 -26
- package/src/programmers/internal/application_default.ts +17 -17
- package/src/programmers/internal/application_definition.ts +45 -45
- package/src/programmers/internal/application_native.ts +39 -39
- package/src/programmers/internal/application_number.ts +74 -74
- package/src/programmers/internal/application_object.ts +167 -167
- package/src/programmers/internal/application_schema.ts +156 -164
- package/src/programmers/internal/application_tuple.ts +47 -77
- package/src/programmers/internal/check_union_array_like.ts +329 -329
- package/src/programmers/internal/feature_object_entries.ts +63 -63
- package/src/programmers/internal/wrap_metadata_rest_tuple.ts +16 -16
- package/src/schemas/IJsonApplication.ts +8 -8
- package/src/schemas/IJsonComponents.ts +34 -45
- package/src/schemas/IJsonSchema.ts +134 -134
- package/src/transformers/CallExpressionTransformer.ts +179 -179
- package/src/transformers/FileTransformer.ts +47 -47
- package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +104 -104
- package/src/transformers/features/miscellaneous/MetadataTransformer.ts +53 -53
- package/src/utils/ArrayUtil.ts +45 -45
- package/src/utils/RandomGenerator.ts +81 -81
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { IdentifierFactory } from "../../factories/IdentifierFactory";
|
|
4
|
-
|
|
5
|
-
import { MetadataObject } from "../../metadata/MetadataObject";
|
|
6
|
-
|
|
7
|
-
import { Escaper } from "../../utils/Escaper";
|
|
8
|
-
|
|
9
|
-
import { FeatureProgrammer } from "../FeatureProgrammer";
|
|
10
|
-
import { FunctionImporter } from "../helpers/FunctionImporeter";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export const feature_object_entries =
|
|
16
|
-
<Output extends ts.ConciseBody>(
|
|
17
|
-
config: Pick<
|
|
18
|
-
FeatureProgrammer.IConfig<Output>,
|
|
19
|
-
"decoder" | "path" | "trace"
|
|
20
|
-
>,
|
|
21
|
-
) =>
|
|
22
|
-
(importer: FunctionImporter) =>
|
|
23
|
-
(obj: MetadataObject) =>
|
|
24
|
-
(input: ts.Expression) =>
|
|
25
|
-
obj.properties.map((prop) => {
|
|
26
|
-
const sole: string | null = prop.key.getSoleLiteral();
|
|
27
|
-
const propInput =
|
|
28
|
-
sole === null
|
|
29
|
-
? ts.factory.createIdentifier("value")
|
|
30
|
-
: Escaper.variable(sole)
|
|
31
|
-
? ts.factory.createPropertyAccessExpression(
|
|
32
|
-
input,
|
|
33
|
-
ts.factory.createIdentifier(sole),
|
|
34
|
-
)
|
|
35
|
-
: ts.factory.createElementAccessExpression(
|
|
36
|
-
input,
|
|
37
|
-
ts.factory.createStringLiteral(sole),
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
input: propInput,
|
|
42
|
-
key: prop.key,
|
|
43
|
-
meta: prop.value,
|
|
44
|
-
expression: config.decoder()(
|
|
45
|
-
propInput,
|
|
46
|
-
prop.value,
|
|
47
|
-
{
|
|
48
|
-
tracable: config.path || config.trace,
|
|
49
|
-
source: "function",
|
|
50
|
-
from: "object",
|
|
51
|
-
postfix:
|
|
52
|
-
sole !== null
|
|
53
|
-
? IdentifierFactory.postfix(sole)
|
|
54
|
-
: (() => {
|
|
55
|
-
importer.use("join");
|
|
56
|
-
return `$join(key)`;
|
|
57
|
-
})(),
|
|
58
|
-
},
|
|
59
|
-
prop.tags,
|
|
60
|
-
prop.jsDocTags,
|
|
61
|
-
),
|
|
62
|
-
};
|
|
63
|
-
});
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IdentifierFactory } from "../../factories/IdentifierFactory";
|
|
4
|
+
|
|
5
|
+
import { MetadataObject } from "../../metadata/MetadataObject";
|
|
6
|
+
|
|
7
|
+
import { Escaper } from "../../utils/Escaper";
|
|
8
|
+
|
|
9
|
+
import { FeatureProgrammer } from "../FeatureProgrammer";
|
|
10
|
+
import { FunctionImporter } from "../helpers/FunctionImporeter";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export const feature_object_entries =
|
|
16
|
+
<Output extends ts.ConciseBody>(
|
|
17
|
+
config: Pick<
|
|
18
|
+
FeatureProgrammer.IConfig<Output>,
|
|
19
|
+
"decoder" | "path" | "trace"
|
|
20
|
+
>,
|
|
21
|
+
) =>
|
|
22
|
+
(importer: FunctionImporter) =>
|
|
23
|
+
(obj: MetadataObject) =>
|
|
24
|
+
(input: ts.Expression) =>
|
|
25
|
+
obj.properties.map((prop) => {
|
|
26
|
+
const sole: string | null = prop.key.getSoleLiteral();
|
|
27
|
+
const propInput =
|
|
28
|
+
sole === null
|
|
29
|
+
? ts.factory.createIdentifier("value")
|
|
30
|
+
: Escaper.variable(sole)
|
|
31
|
+
? ts.factory.createPropertyAccessExpression(
|
|
32
|
+
input,
|
|
33
|
+
ts.factory.createIdentifier(sole),
|
|
34
|
+
)
|
|
35
|
+
: ts.factory.createElementAccessExpression(
|
|
36
|
+
input,
|
|
37
|
+
ts.factory.createStringLiteral(sole),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
input: propInput,
|
|
42
|
+
key: prop.key,
|
|
43
|
+
meta: prop.value,
|
|
44
|
+
expression: config.decoder()(
|
|
45
|
+
propInput,
|
|
46
|
+
prop.value,
|
|
47
|
+
{
|
|
48
|
+
tracable: config.path || config.trace,
|
|
49
|
+
source: "function",
|
|
50
|
+
from: "object",
|
|
51
|
+
postfix:
|
|
52
|
+
sole !== null
|
|
53
|
+
? IdentifierFactory.postfix(sole)
|
|
54
|
+
: (() => {
|
|
55
|
+
importer.use("join");
|
|
56
|
+
return `$join(key)`;
|
|
57
|
+
})(),
|
|
58
|
+
},
|
|
59
|
+
prop.tags,
|
|
60
|
+
prop.jsDocTags,
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Metadata } from "../../metadata/Metadata";
|
|
2
|
-
import { MetadataArray } from "../../metadata/MetadataArray";
|
|
3
|
-
|
|
4
|
-
export const wrap_metadata_rest_tuple = (rest: Metadata) => {
|
|
5
|
-
const wrapper: Metadata = Metadata.initialize();
|
|
6
|
-
wrapper.arrays.push(
|
|
7
|
-
MetadataArray.create({
|
|
8
|
-
name: `...${rest.getName()}`,
|
|
9
|
-
value: rest,
|
|
10
|
-
nullables: [],
|
|
11
|
-
recursive: false,
|
|
12
|
-
index: null,
|
|
13
|
-
}),
|
|
14
|
-
);
|
|
15
|
-
return wrapper;
|
|
16
|
-
};
|
|
1
|
+
import { Metadata } from "../../metadata/Metadata";
|
|
2
|
+
import { MetadataArray } from "../../metadata/MetadataArray";
|
|
3
|
+
|
|
4
|
+
export const wrap_metadata_rest_tuple = (rest: Metadata) => {
|
|
5
|
+
const wrapper: Metadata = Metadata.initialize();
|
|
6
|
+
wrapper.arrays.push(
|
|
7
|
+
MetadataArray.create({
|
|
8
|
+
name: `...${rest.getName()}`,
|
|
9
|
+
value: rest,
|
|
10
|
+
nullables: [],
|
|
11
|
+
recursive: false,
|
|
12
|
+
index: null,
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
15
|
+
return wrapper;
|
|
16
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IJsonComponents } from "./IJsonComponents";
|
|
2
|
-
import { IJsonSchema } from "./IJsonSchema";
|
|
3
|
-
|
|
4
|
-
export interface IJsonApplication {
|
|
5
|
-
schemas: IJsonSchema[];
|
|
6
|
-
components: IJsonComponents;
|
|
7
|
-
purpose: "swagger" | "ajv";
|
|
8
|
-
}
|
|
1
|
+
import { IJsonComponents } from "./IJsonComponents";
|
|
2
|
+
import { IJsonSchema } from "./IJsonSchema";
|
|
3
|
+
|
|
4
|
+
export interface IJsonApplication {
|
|
5
|
+
schemas: IJsonSchema[];
|
|
6
|
+
components: IJsonComponents;
|
|
7
|
+
purpose: "swagger" | "ajv";
|
|
8
|
+
}
|
|
@@ -1,45 +1,34 @@
|
|
|
1
|
-
import { IJsDocTagInfo } from "../metadata/IJsDocTagInfo";
|
|
2
|
-
|
|
3
|
-
import { IJsonSchema } from "./IJsonSchema";
|
|
4
|
-
|
|
5
|
-
export interface IJsonComponents {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
description?: string;
|
|
36
|
-
"x-typia-jsDocTags"?: IJsDocTagInfo[];
|
|
37
|
-
"x-typia-patternProperties"?: Record<string, IJsonSchema>;
|
|
38
|
-
"x-typia-additionalProperties"?: IJsonSchema;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type IAlias = IJsonSchema & {
|
|
42
|
-
$id?: string;
|
|
43
|
-
$recursiveAnchor?: boolean;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
1
|
+
import { IJsDocTagInfo } from "../metadata/IJsDocTagInfo";
|
|
2
|
+
|
|
3
|
+
import { IJsonSchema } from "./IJsonSchema";
|
|
4
|
+
|
|
5
|
+
export interface IJsonComponents {
|
|
6
|
+
schemas?: Record<string, IJsonComponents.IObject | IJsonComponents.IAlias>;
|
|
7
|
+
}
|
|
8
|
+
export namespace IJsonComponents {
|
|
9
|
+
export interface IObject {
|
|
10
|
+
$id?: string;
|
|
11
|
+
$recursiveAnchor?: boolean;
|
|
12
|
+
type: "object";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Only when swagger mode.
|
|
16
|
+
*/
|
|
17
|
+
nullable?: boolean;
|
|
18
|
+
|
|
19
|
+
properties: Record<string, IJsonSchema>;
|
|
20
|
+
patternProperties?: Record<string, IJsonSchema>;
|
|
21
|
+
additionalProperties?: IJsonSchema;
|
|
22
|
+
|
|
23
|
+
required?: string[];
|
|
24
|
+
description?: string;
|
|
25
|
+
"x-typia-jsDocTags"?: IJsDocTagInfo[];
|
|
26
|
+
"x-typia-patternProperties"?: Record<string, IJsonSchema>;
|
|
27
|
+
"x-typia-additionalProperties"?: IJsonSchema;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type IAlias = IJsonSchema & {
|
|
31
|
+
$id?: string;
|
|
32
|
+
$recursiveAnchor?: boolean;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
import { IJsDocTagInfo } from "../metadata/IJsDocTagInfo";
|
|
2
|
-
import { IMetadataTag } from "../metadata/IMetadataTag";
|
|
3
|
-
|
|
4
|
-
import { Atomic } from "../typings/Atomic";
|
|
5
|
-
|
|
6
|
-
export type IJsonSchema = IJsonSchema.Known | IJsonSchema.IUnknown;
|
|
7
|
-
export namespace IJsonSchema {
|
|
8
|
-
export type Known =
|
|
9
|
-
| IEnumeration<"boolean">
|
|
10
|
-
| IEnumeration<"number">
|
|
11
|
-
| IEnumeration<"string">
|
|
12
|
-
| IBoolean
|
|
13
|
-
| IInteger
|
|
14
|
-
| INumber
|
|
15
|
-
| IString
|
|
16
|
-
| IArray
|
|
17
|
-
| ITuple
|
|
18
|
-
| IOneOf
|
|
19
|
-
| IReference
|
|
20
|
-
| IRecursiveReference
|
|
21
|
-
| INullOnly;
|
|
22
|
-
|
|
23
|
-
export interface IUnknown extends IAttribute {
|
|
24
|
-
type?: undefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated Use {@link Known} type instead.
|
|
29
|
-
*/
|
|
30
|
-
export type NotUnknown = Known;
|
|
31
|
-
|
|
32
|
-
/* -----------------------------------------------------------
|
|
33
|
-
ATOMICS
|
|
34
|
-
----------------------------------------------------------- */
|
|
35
|
-
export interface IEnumeration<
|
|
36
|
-
Literal extends Exclude<Atomic.Literal, "bigint">,
|
|
37
|
-
> extends IAtomic<Literal> {
|
|
38
|
-
enum: Array<Atomic.Mapper[Literal]>;
|
|
39
|
-
}
|
|
40
|
-
export interface IAtomic<Literal extends Exclude<Atomic.Literal, "bigint">>
|
|
41
|
-
extends ISignificant<Literal> {
|
|
42
|
-
default?: Atomic.Mapper[Literal];
|
|
43
|
-
}
|
|
44
|
-
export interface IString extends IAtomic<"string"> {
|
|
45
|
-
/**
|
|
46
|
-
* @type uint
|
|
47
|
-
*/
|
|
48
|
-
minLength?: number;
|
|
49
|
-
/**
|
|
50
|
-
* @type uint
|
|
51
|
-
*/
|
|
52
|
-
maxLength?: number;
|
|
53
|
-
pattern?: string;
|
|
54
|
-
format?: string;
|
|
55
|
-
}
|
|
56
|
-
export interface INumber extends IAtomic<"number"> {
|
|
57
|
-
minimum?: number;
|
|
58
|
-
maximum?: number;
|
|
59
|
-
exclusiveMinimum?: boolean;
|
|
60
|
-
exclusiveMaximum?: boolean;
|
|
61
|
-
multipleOf?: number;
|
|
62
|
-
}
|
|
63
|
-
export interface IInteger extends IAtomic<"integer"> {
|
|
64
|
-
/**
|
|
65
|
-
* @type int
|
|
66
|
-
*/
|
|
67
|
-
minimum?: number;
|
|
68
|
-
/**
|
|
69
|
-
* @type int
|
|
70
|
-
*/
|
|
71
|
-
maximum?: number;
|
|
72
|
-
exclusiveMinimum?: boolean;
|
|
73
|
-
exclusiveMaximum?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* @type int
|
|
76
|
-
*/
|
|
77
|
-
multipleOf?: number;
|
|
78
|
-
}
|
|
79
|
-
export interface IBoolean extends IAtomic<"boolean"> {}
|
|
80
|
-
|
|
81
|
-
/* -----------------------------------------------------------
|
|
82
|
-
OBJECTS
|
|
83
|
-
----------------------------------------------------------- */
|
|
84
|
-
export interface IArray extends ISignificant<"array"> {
|
|
85
|
-
items: IJsonSchema;
|
|
86
|
-
/**
|
|
87
|
-
* @type uint
|
|
88
|
-
*/
|
|
89
|
-
minItems?: number;
|
|
90
|
-
/**
|
|
91
|
-
* @type uint
|
|
92
|
-
*/
|
|
93
|
-
maxItems?: number;
|
|
94
|
-
"x-typia-tuple"?: ITuple;
|
|
95
|
-
}
|
|
96
|
-
export interface ITuple extends ISignificant<"array"> {
|
|
97
|
-
items: IJsonSchema[];
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"x-typia-
|
|
130
|
-
"x-typia-
|
|
131
|
-
"x-typia-
|
|
132
|
-
"x-typia-
|
|
133
|
-
}
|
|
134
|
-
}
|
|
1
|
+
import { IJsDocTagInfo } from "../metadata/IJsDocTagInfo";
|
|
2
|
+
import { IMetadataTag } from "../metadata/IMetadataTag";
|
|
3
|
+
|
|
4
|
+
import { Atomic } from "../typings/Atomic";
|
|
5
|
+
|
|
6
|
+
export type IJsonSchema = IJsonSchema.Known | IJsonSchema.IUnknown;
|
|
7
|
+
export namespace IJsonSchema {
|
|
8
|
+
export type Known =
|
|
9
|
+
| IEnumeration<"boolean">
|
|
10
|
+
| IEnumeration<"number">
|
|
11
|
+
| IEnumeration<"string">
|
|
12
|
+
| IBoolean
|
|
13
|
+
| IInteger
|
|
14
|
+
| INumber
|
|
15
|
+
| IString
|
|
16
|
+
| IArray
|
|
17
|
+
| ITuple
|
|
18
|
+
| IOneOf
|
|
19
|
+
| IReference
|
|
20
|
+
| IRecursiveReference
|
|
21
|
+
| INullOnly;
|
|
22
|
+
|
|
23
|
+
export interface IUnknown extends IAttribute {
|
|
24
|
+
type?: undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use {@link Known} type instead.
|
|
29
|
+
*/
|
|
30
|
+
export type NotUnknown = Known;
|
|
31
|
+
|
|
32
|
+
/* -----------------------------------------------------------
|
|
33
|
+
ATOMICS
|
|
34
|
+
----------------------------------------------------------- */
|
|
35
|
+
export interface IEnumeration<
|
|
36
|
+
Literal extends Exclude<Atomic.Literal, "bigint">,
|
|
37
|
+
> extends IAtomic<Literal> {
|
|
38
|
+
enum: Array<Atomic.Mapper[Literal]>;
|
|
39
|
+
}
|
|
40
|
+
export interface IAtomic<Literal extends Exclude<Atomic.Literal, "bigint">>
|
|
41
|
+
extends ISignificant<Literal> {
|
|
42
|
+
default?: Atomic.Mapper[Literal];
|
|
43
|
+
}
|
|
44
|
+
export interface IString extends IAtomic<"string"> {
|
|
45
|
+
/**
|
|
46
|
+
* @type uint
|
|
47
|
+
*/
|
|
48
|
+
minLength?: number;
|
|
49
|
+
/**
|
|
50
|
+
* @type uint
|
|
51
|
+
*/
|
|
52
|
+
maxLength?: number;
|
|
53
|
+
pattern?: string;
|
|
54
|
+
format?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface INumber extends IAtomic<"number"> {
|
|
57
|
+
minimum?: number;
|
|
58
|
+
maximum?: number;
|
|
59
|
+
exclusiveMinimum?: boolean;
|
|
60
|
+
exclusiveMaximum?: boolean;
|
|
61
|
+
multipleOf?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface IInteger extends IAtomic<"integer"> {
|
|
64
|
+
/**
|
|
65
|
+
* @type int
|
|
66
|
+
*/
|
|
67
|
+
minimum?: number;
|
|
68
|
+
/**
|
|
69
|
+
* @type int
|
|
70
|
+
*/
|
|
71
|
+
maximum?: number;
|
|
72
|
+
exclusiveMinimum?: boolean;
|
|
73
|
+
exclusiveMaximum?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* @type int
|
|
76
|
+
*/
|
|
77
|
+
multipleOf?: number;
|
|
78
|
+
}
|
|
79
|
+
export interface IBoolean extends IAtomic<"boolean"> {}
|
|
80
|
+
|
|
81
|
+
/* -----------------------------------------------------------
|
|
82
|
+
OBJECTS
|
|
83
|
+
----------------------------------------------------------- */
|
|
84
|
+
export interface IArray extends ISignificant<"array"> {
|
|
85
|
+
items: IJsonSchema;
|
|
86
|
+
/**
|
|
87
|
+
* @type uint
|
|
88
|
+
*/
|
|
89
|
+
minItems?: number;
|
|
90
|
+
/**
|
|
91
|
+
* @type uint
|
|
92
|
+
*/
|
|
93
|
+
maxItems?: number;
|
|
94
|
+
"x-typia-tuple"?: ITuple;
|
|
95
|
+
}
|
|
96
|
+
export interface ITuple extends ISignificant<"array"> {
|
|
97
|
+
items: IJsonSchema[];
|
|
98
|
+
}
|
|
99
|
+
export interface IReference extends IAttribute {
|
|
100
|
+
$ref: string;
|
|
101
|
+
}
|
|
102
|
+
export interface IRecursiveReference extends IAttribute {
|
|
103
|
+
$recursiveRef: string;
|
|
104
|
+
}
|
|
105
|
+
export interface INullOnly extends IAttribute {
|
|
106
|
+
type: "null";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* -----------------------------------------------------------
|
|
110
|
+
MISCELLANEOUS
|
|
111
|
+
----------------------------------------------------------- */
|
|
112
|
+
export interface IOneOf extends IAttribute {
|
|
113
|
+
oneOf: IJsonSchema[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ISignificant<Literal extends string> extends IAttribute {
|
|
117
|
+
type: Literal;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Only when swagger mode.
|
|
121
|
+
*/
|
|
122
|
+
nullable?: boolean;
|
|
123
|
+
}
|
|
124
|
+
export interface IAttribute {
|
|
125
|
+
deprecated?: boolean;
|
|
126
|
+
title?: string;
|
|
127
|
+
description?: string;
|
|
128
|
+
"x-typia-metaTags"?: IMetadataTag[];
|
|
129
|
+
"x-typia-jsDocTags"?: IJsDocTagInfo[];
|
|
130
|
+
"x-typia-required"?: boolean;
|
|
131
|
+
"x-typia-optional"?: boolean;
|
|
132
|
+
"x-typia-rest"?: boolean;
|
|
133
|
+
}
|
|
134
|
+
}
|