typia 7.0.0-dev.20241011 → 7.0.0-dev.20241012
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/factories/MetadataCollection.d.ts +4 -4
- package/lib/factories/MetadataCollection.js +6 -4
- package/lib/factories/MetadataCollection.js.map +1 -1
- package/lib/factories/MetadataFactory.d.ts +2 -2
- package/lib/factories/MetadataFactory.js +8 -2
- package/lib/factories/MetadataFactory.js.map +1 -1
- package/lib/factories/MetadataTypeTagFactory.d.ts +2 -2
- package/lib/factories/MetadataTypeTagFactory.js +6 -6
- package/lib/factories/MetadataTypeTagFactory.js.map +1 -1
- package/lib/factories/MetadataTypeTagSchemaFactory.d.ts +2 -2
- package/lib/factories/MetadataTypeTagSchemaFactory.js +1 -1
- package/lib/factories/MetadataTypeTagSchemaFactory.js.map +1 -1
- package/lib/factories/ProtobufFactory.js +12 -22
- package/lib/factories/ProtobufFactory.js.map +1 -1
- package/lib/factories/internal/metadata/emplace_metadata_object.d.ts +2 -2
- package/lib/factories/internal/metadata/iterate_metadata_collection.js +2 -1
- package/lib/factories/internal/metadata/iterate_metadata_collection.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_comment_tags.d.ts +2 -2
- package/lib/factories/internal/metadata/iterate_metadata_intersection.js +5 -2
- package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_object.js +5 -1
- package/lib/factories/internal/metadata/iterate_metadata_object.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_sort.js +6 -2
- package/lib/factories/internal/metadata/iterate_metadata_sort.js.map +1 -1
- package/lib/internal/$ProtobufSizer.js +1 -8
- package/lib/internal/$ProtobufSizer.js.map +1 -1
- package/lib/json.d.ts +1 -1
- package/lib/module.d.ts +1 -1
- package/lib/module.js +1 -1
- package/lib/module.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.d.ts +2 -2
- package/lib/programmers/CheckerProgrammer.js +5 -3
- package/lib/programmers/CheckerProgrammer.js.map +1 -1
- package/lib/programmers/FeatureProgrammer.d.ts +5 -5
- package/lib/programmers/FeatureProgrammer.js.map +1 -1
- package/lib/programmers/IsProgrammer.d.ts +2 -2
- package/lib/programmers/RandomProgrammer.js +1 -1
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/helpers/ProtobufUtil.d.ts +2 -2
- package/lib/programmers/helpers/ProtobufUtil.js.map +1 -1
- package/lib/programmers/helpers/PruneJoiner.d.ts +2 -2
- package/lib/programmers/helpers/RandomJoiner.d.ts +2 -2
- package/lib/programmers/helpers/UnionExplorer.d.ts +3 -3
- package/lib/programmers/helpers/UnionExplorer.js.map +1 -1
- package/lib/programmers/helpers/UnionPredicator.d.ts +3 -3
- package/lib/programmers/helpers/UnionPredicator.js.map +1 -1
- package/lib/programmers/http/HttpFormDataProgrammer.js +1 -1
- package/lib/programmers/http/HttpFormDataProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpHeadersProgrammer.js +1 -1
- package/lib/programmers/http/HttpHeadersProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpQueryProgrammer.js +2 -2
- package/lib/programmers/http/HttpQueryProgrammer.js.map +1 -1
- package/lib/programmers/internal/application_union_discriminator.js +2 -2
- package/lib/programmers/internal/application_union_discriminator.js.map +1 -1
- package/lib/programmers/internal/application_v30_alias.js +1 -1
- package/lib/programmers/internal/application_v30_alias.js.map +1 -1
- package/lib/programmers/internal/application_v30_schema.js +1 -1
- package/lib/programmers/internal/application_v30_schema.js.map +1 -1
- package/lib/programmers/internal/application_v31_alias.js +1 -1
- package/lib/programmers/internal/application_v31_alias.js.map +1 -1
- package/lib/programmers/internal/application_v31_schema.js +1 -1
- package/lib/programmers/internal/application_v31_schema.js.map +1 -1
- package/lib/programmers/internal/llm_schema_object.js +1 -1
- package/lib/programmers/internal/llm_schema_object.js.map +1 -1
- package/lib/programmers/internal/llm_schema_station.js +2 -2
- package/lib/programmers/internal/llm_schema_station.js.map +1 -1
- package/lib/programmers/internal/prune_object_properties.js.map +1 -1
- package/lib/programmers/json/JsonApplicationProgrammer.js +6 -5
- package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
- package/lib/programmers/json/JsonSchemasProgrammer.d.ts +1 -1
- package/lib/programmers/json/JsonStringifyProgrammer.js +3 -3
- package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.js +7 -6
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.js +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscCloneProgrammer.js +1 -1
- package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscPruneProgrammer.js +1 -1
- package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
- package/lib/programmers/notations/NotationGeneralProgrammer.js +1 -1
- package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +6 -6
- package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +1 -1
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js +3 -3
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
- package/lib/schemas/json/IJsonSchemaCollection.js +3 -0
- package/lib/schemas/json/IJsonSchemaCollection.js.map +1 -0
- package/lib/schemas/metadata/IMetadata.d.ts +4 -1
- package/lib/schemas/metadata/IMetadataArray.d.ts +1 -2
- package/lib/schemas/metadata/IMetadataComponents.d.ts +2 -2
- package/lib/schemas/metadata/IMetadataDictionary.d.ts +2 -2
- package/lib/schemas/metadata/IMetadataObject.d.ts +2 -8
- package/lib/schemas/metadata/IMetadataObjectType.d.ts +11 -0
- package/lib/schemas/{json/IJsonSchemaList.js → metadata/IMetadataObjectType.js} +1 -1
- package/lib/schemas/metadata/IMetadataObjectType.js.map +1 -0
- package/lib/schemas/metadata/IMetadataTuple.d.ts +1 -2
- package/lib/schemas/metadata/Metadata.js +14 -15
- package/lib/schemas/metadata/Metadata.js.map +1 -1
- package/lib/schemas/metadata/MetadataArray.js +1 -1
- package/lib/schemas/metadata/MetadataArray.js.map +1 -1
- package/lib/schemas/metadata/MetadataComponents.d.ts +2 -2
- package/lib/schemas/metadata/MetadataComponents.js +2 -2
- package/lib/schemas/metadata/MetadataComponents.js.map +1 -1
- package/lib/schemas/metadata/MetadataObject.d.ts +8 -12
- package/lib/schemas/metadata/MetadataObject.js +44 -82
- package/lib/schemas/metadata/MetadataObject.js.map +1 -1
- package/lib/schemas/metadata/MetadataObjectType.d.ts +20 -0
- package/lib/schemas/metadata/MetadataObjectType.js +106 -0
- package/lib/schemas/metadata/MetadataObjectType.js.map +1 -0
- package/lib/schemas/metadata/MetadataTuple.js +1 -1
- package/lib/schemas/metadata/MetadataTuple.js.map +1 -1
- package/lib/transformers/TransformerError.js.map +1 -1
- package/package.json +2 -2
- package/src/executable/TypiaGenerateWizard.ts +83 -83
- package/src/executable/TypiaSetupWizard.ts +174 -174
- package/src/executable/setup/ArgumentParser.ts +42 -42
- package/src/executable/setup/FileRetriever.ts +19 -19
- package/src/executable/setup/PackageManager.ts +87 -87
- package/src/factories/IdentifierFactory.ts +89 -89
- package/src/factories/MetadataCollection.ts +280 -278
- package/src/factories/MetadataFactory.ts +11 -5
- package/src/factories/MetadataTypeTagFactory.ts +386 -385
- package/src/factories/MetadataTypeTagSchemaFactory.ts +82 -82
- package/src/factories/NumericRangeFactory.ts +72 -72
- package/src/factories/ProtobufFactory.ts +14 -28
- package/src/factories/StatementFactory.ts +90 -90
- package/src/factories/TemplateFactory.ts +64 -64
- package/src/factories/TypeFactory.ts +140 -140
- package/src/factories/internal/metadata/emplace_metadata_alias.ts +32 -32
- package/src/factories/internal/metadata/emplace_metadata_array_type.ts +39 -39
- package/src/factories/internal/metadata/emplace_metadata_object.ts +2 -2
- package/src/factories/internal/metadata/emplace_metadata_tuple.ts +56 -56
- package/src/factories/internal/metadata/explore_metadata.ts +30 -30
- package/src/factories/internal/metadata/iterate_metadata.ts +54 -54
- package/src/factories/internal/metadata/iterate_metadata_alias.ts +28 -28
- package/src/factories/internal/metadata/iterate_metadata_array.ts +63 -63
- package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
- package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +28 -28
- package/src/factories/internal/metadata/iterate_metadata_collection.ts +4 -3
- package/src/factories/internal/metadata/iterate_metadata_comment_tags.ts +2 -2
- package/src/factories/internal/metadata/iterate_metadata_constant.ts +76 -76
- package/src/factories/internal/metadata/iterate_metadata_escape.ts +49 -49
- package/src/factories/internal/metadata/iterate_metadata_intersection.ts +219 -216
- package/src/factories/internal/metadata/iterate_metadata_map.ts +52 -52
- package/src/factories/internal/metadata/iterate_metadata_native.ts +236 -236
- package/src/factories/internal/metadata/iterate_metadata_object.ts +35 -27
- package/src/factories/internal/metadata/iterate_metadata_set.ts +39 -39
- package/src/factories/internal/metadata/iterate_metadata_sort.ts +87 -83
- package/src/factories/internal/metadata/iterate_metadata_template.ts +42 -42
- package/src/factories/internal/metadata/iterate_metadata_tuple.ts +26 -26
- package/src/factories/internal/metadata/iterate_metadata_union.ts +19 -19
- package/src/internal/$ProtobufSizer.ts +1 -7
- package/src/json.ts +1 -1
- package/src/module.ts +1 -1
- package/src/programmers/CheckerProgrammer.ts +7 -5
- package/src/programmers/FeatureProgrammer.ts +9 -6
- package/src/programmers/IsProgrammer.ts +2 -2
- package/src/programmers/RandomProgrammer.ts +3 -3
- package/src/programmers/functional/FunctionalIsFunctionProgrammer.ts +72 -72
- package/src/programmers/functional/FunctionalIsParametersProgrammer.ts +113 -113
- package/src/programmers/functional/FunctionalIsReturnProgrammer.ts +116 -116
- package/src/programmers/functional/internal/FunctionalGeneralProgrammer.ts +34 -34
- package/src/programmers/helpers/AtomicPredicator.ts +35 -35
- package/src/programmers/helpers/CloneJoiner.ts +143 -143
- package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
- package/src/programmers/helpers/NotationJoiner.ts +144 -144
- package/src/programmers/helpers/ProtobufUtil.ts +125 -125
- package/src/programmers/helpers/PruneJoiner.ts +148 -148
- package/src/programmers/helpers/RandomJoiner.ts +2 -2
- package/src/programmers/helpers/StringifyPredicator.ts +13 -13
- package/src/programmers/helpers/UnionExplorer.ts +372 -372
- package/src/programmers/helpers/UnionPredicator.ts +79 -77
- package/src/programmers/http/HttpFormDataProgrammer.ts +3 -3
- package/src/programmers/http/HttpHeadersProgrammer.ts +3 -3
- package/src/programmers/http/HttpQueryProgrammer.ts +4 -4
- package/src/programmers/internal/application_array.ts +56 -56
- package/src/programmers/internal/application_bigint.ts +25 -25
- package/src/programmers/internal/application_boolean.ts +25 -25
- package/src/programmers/internal/application_escaped.ts +96 -96
- package/src/programmers/internal/application_number.ts +25 -25
- package/src/programmers/internal/application_plugin.ts +19 -19
- package/src/programmers/internal/application_string.ts +25 -25
- package/src/programmers/internal/application_templates.ts +64 -64
- package/src/programmers/internal/application_union_discriminator.ts +35 -35
- package/src/programmers/internal/application_v30_alias.ts +59 -59
- package/src/programmers/internal/application_v30_native.ts +29 -29
- package/src/programmers/internal/application_v30_object.ts +165 -165
- package/src/programmers/internal/application_v30_schema.ts +220 -220
- package/src/programmers/internal/application_v30_tuple.ts +33 -33
- package/src/programmers/internal/application_v31_alias.ts +47 -47
- package/src/programmers/internal/application_v31_constant.ts +29 -29
- package/src/programmers/internal/application_v31_native.ts +25 -25
- package/src/programmers/internal/application_v31_object.ts +147 -147
- package/src/programmers/internal/application_v31_schema.ts +215 -215
- package/src/programmers/internal/application_v31_tuple.ts +22 -22
- package/src/programmers/internal/check_array_length.ts +46 -46
- package/src/programmers/internal/check_bigint.ts +49 -49
- package/src/programmers/internal/check_everything.ts +23 -23
- package/src/programmers/internal/check_native.ts +27 -27
- package/src/programmers/internal/check_number.ts +111 -111
- package/src/programmers/internal/check_string.ts +49 -49
- package/src/programmers/internal/check_template.ts +48 -48
- package/src/programmers/internal/check_union_array_like.ts +334 -334
- package/src/programmers/internal/decode_union_object.ts +116 -116
- package/src/programmers/internal/feature_object_entries.ts +2 -2
- package/src/programmers/internal/llm_schema_array.ts +22 -22
- package/src/programmers/internal/llm_schema_escaped.ts +84 -84
- package/src/programmers/internal/llm_schema_object.ts +132 -132
- package/src/programmers/internal/llm_schema_station.ts +190 -190
- package/src/programmers/internal/metadata_to_pattern.ts +42 -42
- package/src/programmers/internal/postfix_of_tuple.ts +5 -5
- package/src/programmers/internal/prune_object_properties.ts +2 -2
- package/src/programmers/internal/stringify_dynamic_properties.ts +162 -162
- package/src/programmers/internal/stringify_regular_properties.ts +81 -81
- package/src/programmers/internal/template_to_pattern.ts +23 -23
- package/src/programmers/internal/wrap_metadata_rest_tuple.ts +23 -23
- package/src/programmers/json/JsonApplicationProgrammer.ts +3 -3
- package/src/programmers/json/JsonSchemasProgrammer.ts +1 -1
- package/src/programmers/json/JsonStringifyProgrammer.ts +5 -5
- package/src/programmers/llm/LlmApplicationProgrammer.ts +4 -4
- package/src/programmers/llm/LlmSchemaProgrammer.ts +1 -1
- package/src/programmers/misc/MiscCloneProgrammer.ts +3 -3
- package/src/programmers/misc/MiscPruneProgrammer.ts +3 -3
- package/src/programmers/notations/NotationGeneralProgrammer.ts +3 -3
- package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +11 -11
- package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +8 -8
- package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +201 -201
- package/src/schemas/json/{IJsonSchemaList.ts → IJsonSchemaCollection.ts} +22 -22
- package/src/schemas/metadata/IMetadata.ts +4 -1
- package/src/schemas/metadata/IMetadataArray.ts +1 -2
- package/src/schemas/metadata/IMetadataComponents.ts +2 -2
- package/src/schemas/metadata/IMetadataDictionary.ts +11 -11
- package/src/schemas/metadata/IMetadataObject.ts +6 -13
- package/src/schemas/metadata/IMetadataObjectType.ts +13 -0
- package/src/schemas/metadata/IMetadataTuple.ts +1 -2
- package/src/schemas/metadata/Metadata.ts +616 -616
- package/src/schemas/metadata/MetadataArray.ts +1 -1
- package/src/schemas/metadata/MetadataComponents.ts +98 -98
- package/src/schemas/metadata/MetadataObject.ts +48 -139
- package/src/schemas/metadata/MetadataObjectType.ts +149 -0
- package/src/schemas/metadata/MetadataTuple.ts +1 -1
- package/src/transformers/TransformerError.ts +8 -7
- package/src/transformers/features/json/JsonSchemasTransformer.ts +1 -1
- package/src/utils/MapUtil.ts +14 -14
- package/src/utils/NameEncoder.ts +32 -32
- package/lib/schemas/json/IJsonSchemaList.js.map +0 -1
- /package/lib/schemas/json/{IJsonSchemaList.d.ts → IJsonSchemaCollection.d.ts} +0 -0
|
@@ -1,77 +1,79 @@
|
|
|
1
|
-
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
2
|
-
import {
|
|
3
|
-
import { MetadataProperty } from "../../schemas/metadata/MetadataProperty";
|
|
4
|
-
|
|
5
|
-
import { ArrayUtil } from "../../utils/ArrayUtil";
|
|
6
|
-
import { MapUtil } from "../../utils/MapUtil";
|
|
7
|
-
|
|
8
|
-
export namespace UnionPredicator {
|
|
9
|
-
export interface ISpecialized {
|
|
10
|
-
index: number;
|
|
11
|
-
object:
|
|
12
|
-
property: MetadataProperty;
|
|
13
|
-
neighbour: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const object = (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
1
|
+
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
2
|
+
import { MetadataObjectType } from "../../schemas/metadata/MetadataObjectType";
|
|
3
|
+
import { MetadataProperty } from "../../schemas/metadata/MetadataProperty";
|
|
4
|
+
|
|
5
|
+
import { ArrayUtil } from "../../utils/ArrayUtil";
|
|
6
|
+
import { MapUtil } from "../../utils/MapUtil";
|
|
7
|
+
|
|
8
|
+
export namespace UnionPredicator {
|
|
9
|
+
export interface ISpecialized {
|
|
10
|
+
index: number;
|
|
11
|
+
object: MetadataObjectType;
|
|
12
|
+
property: MetadataProperty;
|
|
13
|
+
neighbour: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const object = (
|
|
17
|
+
objects: MetadataObjectType[],
|
|
18
|
+
): Array<ISpecialized> => {
|
|
19
|
+
// PROPERTY MATRIX
|
|
20
|
+
const matrix: Map<string, Array<MetadataProperty | null>> = new Map();
|
|
21
|
+
for (const obj of objects)
|
|
22
|
+
for (const prop of obj.properties) {
|
|
23
|
+
const key: string | null = prop.key.getSoleLiteral();
|
|
24
|
+
if (key !== null)
|
|
25
|
+
MapUtil.take(matrix, key, () =>
|
|
26
|
+
ArrayUtil.repeat(objects.length, () => null),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
objects.forEach((obj, i) => {
|
|
30
|
+
for (const prop of obj.properties) {
|
|
31
|
+
const key: string | null = prop.key.getSoleLiteral();
|
|
32
|
+
if (key !== null) matrix.get(key)![i] = prop;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// EXPLORE SPECIALIZERS
|
|
37
|
+
const output: ISpecialized[] = [];
|
|
38
|
+
objects.forEach((obj, i) => {
|
|
39
|
+
const children: ISpecializedProperty[] = [];
|
|
40
|
+
obj.properties.forEach((prop) => {
|
|
41
|
+
// MUST BE REQUIRED
|
|
42
|
+
if (prop.value.isRequired() === false) return;
|
|
43
|
+
const key: string | null = prop.key.getSoleLiteral();
|
|
44
|
+
if (key === null) return;
|
|
45
|
+
|
|
46
|
+
// FIND NEIGHBORHOOD PROPERTIES
|
|
47
|
+
const neighbors: MetadataProperty[] = matrix
|
|
48
|
+
.get(key)!
|
|
49
|
+
.filter((oppo, k) => i !== k && oppo !== null) as MetadataProperty[];
|
|
50
|
+
|
|
51
|
+
// NO NEIGHBORHOOD
|
|
52
|
+
const unique: boolean =
|
|
53
|
+
neighbors.length === 0 ||
|
|
54
|
+
neighbors.every((n) => !Metadata.intersects(prop.value, n.value));
|
|
55
|
+
if (unique === true)
|
|
56
|
+
children.push({
|
|
57
|
+
property: prop,
|
|
58
|
+
neighbour: neighbors.length !== 0,
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
if (children.length === 0) return;
|
|
62
|
+
|
|
63
|
+
const top: ISpecializedProperty =
|
|
64
|
+
children.find((child) => child.property.value.isConstant()) ||
|
|
65
|
+
children[0]!;
|
|
66
|
+
output.push({
|
|
67
|
+
index: i,
|
|
68
|
+
object: obj,
|
|
69
|
+
...top,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
return output;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface ISpecializedProperty {
|
|
77
|
+
property: MetadataProperty;
|
|
78
|
+
neighbour: boolean;
|
|
79
|
+
}
|
|
@@ -8,7 +8,7 @@ import { TypeFactory } from "../../factories/TypeFactory";
|
|
|
8
8
|
|
|
9
9
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
10
10
|
import { MetadataArrayType } from "../../schemas/metadata/MetadataArrayType";
|
|
11
|
-
import {
|
|
11
|
+
import { MetadataObjectType } from "../../schemas/metadata/MetadataObjectType";
|
|
12
12
|
import { MetadataProperty } from "../../schemas/metadata/MetadataProperty";
|
|
13
13
|
|
|
14
14
|
import { IProgrammerProps } from "../../transformers/IProgrammerProps";
|
|
@@ -52,7 +52,7 @@ export namespace HttpFormDataProgrammer {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
// DO TRANSFORM
|
|
55
|
-
const object:
|
|
55
|
+
const object: MetadataObjectType = result.data.objects[0]!.type;
|
|
56
56
|
const statements: ts.Statement[] = decode_object({
|
|
57
57
|
context: props.context,
|
|
58
58
|
object,
|
|
@@ -160,7 +160,7 @@ export namespace HttpFormDataProgrammer {
|
|
|
160
160
|
|
|
161
161
|
const decode_object = (props: {
|
|
162
162
|
context: ITypiaContext;
|
|
163
|
-
object:
|
|
163
|
+
object: MetadataObjectType;
|
|
164
164
|
}): ts.Statement[] => {
|
|
165
165
|
// const input: ts.Identifier = ts.factory.createIdentifier("input");
|
|
166
166
|
const output: ts.Identifier = ts.factory.createIdentifier("output");
|
|
@@ -9,7 +9,7 @@ import { TypeFactory } from "../../factories/TypeFactory";
|
|
|
9
9
|
|
|
10
10
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
11
11
|
import { MetadataArrayType } from "../../schemas/metadata/MetadataArrayType";
|
|
12
|
-
import {
|
|
12
|
+
import { MetadataObjectType } from "../../schemas/metadata/MetadataObjectType";
|
|
13
13
|
import { MetadataProperty } from "../../schemas/metadata/MetadataProperty";
|
|
14
14
|
|
|
15
15
|
import { IProgrammerProps } from "../../transformers/IProgrammerProps";
|
|
@@ -56,7 +56,7 @@ export namespace HttpHeadersProgrammer {
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
// DO TRANSFORM
|
|
59
|
-
const object:
|
|
59
|
+
const object: MetadataObjectType = result.data.objects[0]!.type;
|
|
60
60
|
const statements: ts.Statement[] = decode_object({
|
|
61
61
|
context: props.context,
|
|
62
62
|
object,
|
|
@@ -204,7 +204,7 @@ export namespace HttpHeadersProgrammer {
|
|
|
204
204
|
|
|
205
205
|
const decode_object = (props: {
|
|
206
206
|
context: ITypiaContext;
|
|
207
|
-
object:
|
|
207
|
+
object: MetadataObjectType;
|
|
208
208
|
}): ts.Statement[] => {
|
|
209
209
|
const output: ts.Identifier = ts.factory.createIdentifier("output");
|
|
210
210
|
const optionals: string[] = [];
|
|
@@ -8,7 +8,7 @@ import { TypeFactory } from "../../factories/TypeFactory";
|
|
|
8
8
|
|
|
9
9
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
10
10
|
import { MetadataArrayType } from "../../schemas/metadata/MetadataArrayType";
|
|
11
|
-
import {
|
|
11
|
+
import { MetadataObjectType } from "../../schemas/metadata/MetadataObjectType";
|
|
12
12
|
import { MetadataProperty } from "../../schemas/metadata/MetadataProperty";
|
|
13
13
|
|
|
14
14
|
import { IProgrammerProps } from "../../transformers/IProgrammerProps";
|
|
@@ -60,7 +60,7 @@ export namespace HttpQueryProgrammer {
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
// DO TRANSFORM
|
|
63
|
-
const object:
|
|
63
|
+
const object: MetadataObjectType = result.data.objects[0]!.type;
|
|
64
64
|
const statements: ts.Statement[] = decode_object({
|
|
65
65
|
context: props.context,
|
|
66
66
|
object,
|
|
@@ -130,7 +130,7 @@ export namespace HttpQueryProgrammer {
|
|
|
130
130
|
const everyPropertiesAreOptional: boolean =
|
|
131
131
|
meta.size() === 1 &&
|
|
132
132
|
meta.objects.length === 1 &&
|
|
133
|
-
meta.objects[0]!.properties.every(
|
|
133
|
+
meta.objects[0]!.type.properties.every(
|
|
134
134
|
(p) => p.value.isRequired() === false,
|
|
135
135
|
);
|
|
136
136
|
if (everyPropertiesAreOptional === false)
|
|
@@ -179,7 +179,7 @@ export namespace HttpQueryProgrammer {
|
|
|
179
179
|
|
|
180
180
|
const decode_object = (props: {
|
|
181
181
|
context: ITypiaContext;
|
|
182
|
-
object:
|
|
182
|
+
object: MetadataObjectType;
|
|
183
183
|
}): ts.Statement[] => {
|
|
184
184
|
const input: ts.Identifier = ts.factory.createIdentifier("input");
|
|
185
185
|
const output: ts.Identifier = ts.factory.createIdentifier("output");
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
4
|
-
import { MetadataArray } from "../../schemas/metadata/MetadataArray";
|
|
5
|
-
|
|
6
|
-
import { application_plugin } from "./application_plugin";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export const application_array = <Version extends "3.0" | "3.1">(props: {
|
|
12
|
-
generator: (value: Metadata) => Schema<Version>;
|
|
13
|
-
components: Version extends "3.0"
|
|
14
|
-
? OpenApiV3.IComponents
|
|
15
|
-
: OpenApi.IComponents;
|
|
16
|
-
array: MetadataArray;
|
|
17
|
-
}): Array<ArraySchema<Version> | OpenApiV3.IJsonSchema.IReference> => {
|
|
18
|
-
const factory = (): ArraySchema<Version>[] =>
|
|
19
|
-
application_plugin<ArraySchema<Version>>({
|
|
20
|
-
schema: {
|
|
21
|
-
type: "array",
|
|
22
|
-
items: props.generator(props.array.type.value),
|
|
23
|
-
} as ArraySchema<Version>,
|
|
24
|
-
tags: props.array.tags,
|
|
25
|
-
});
|
|
26
|
-
if (props.array.type.recursive === true) {
|
|
27
|
-
const out = () => [{ $ref }];
|
|
28
|
-
const $ref: string = `#/components/schemas/${props.array.type.name}`;
|
|
29
|
-
if (props.components.schemas?.[$ref] !== undefined) return out();
|
|
30
|
-
|
|
31
|
-
props.components.schemas ??= {};
|
|
32
|
-
props.components.schemas[$ref] ??= {};
|
|
33
|
-
|
|
34
|
-
const oneOf: ArraySchema<Version>[] = factory();
|
|
35
|
-
Object.assign(
|
|
36
|
-
props.components.schemas[$ref]!,
|
|
37
|
-
oneOf.length === 1 ? oneOf[0] : { oneOf },
|
|
38
|
-
);
|
|
39
|
-
return out();
|
|
40
|
-
}
|
|
41
|
-
return factory();
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
type ArraySchema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
48
|
-
? OpenApiV3.IJsonSchema.IArray
|
|
49
|
-
: OpenApi.IJsonSchema.IArray;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
type Schema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
55
|
-
? OpenApiV3.IJsonSchema
|
|
56
|
-
: OpenApi.IJsonSchema;
|
|
1
|
+
import { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
4
|
+
import { MetadataArray } from "../../schemas/metadata/MetadataArray";
|
|
5
|
+
|
|
6
|
+
import { application_plugin } from "./application_plugin";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export const application_array = <Version extends "3.0" | "3.1">(props: {
|
|
12
|
+
generator: (value: Metadata) => Schema<Version>;
|
|
13
|
+
components: Version extends "3.0"
|
|
14
|
+
? OpenApiV3.IComponents
|
|
15
|
+
: OpenApi.IComponents;
|
|
16
|
+
array: MetadataArray;
|
|
17
|
+
}): Array<ArraySchema<Version> | OpenApiV3.IJsonSchema.IReference> => {
|
|
18
|
+
const factory = (): ArraySchema<Version>[] =>
|
|
19
|
+
application_plugin<ArraySchema<Version>>({
|
|
20
|
+
schema: {
|
|
21
|
+
type: "array",
|
|
22
|
+
items: props.generator(props.array.type.value),
|
|
23
|
+
} as ArraySchema<Version>,
|
|
24
|
+
tags: props.array.tags,
|
|
25
|
+
});
|
|
26
|
+
if (props.array.type.recursive === true) {
|
|
27
|
+
const out = () => [{ $ref }];
|
|
28
|
+
const $ref: string = `#/components/schemas/${props.array.type.name}`;
|
|
29
|
+
if (props.components.schemas?.[$ref] !== undefined) return out();
|
|
30
|
+
|
|
31
|
+
props.components.schemas ??= {};
|
|
32
|
+
props.components.schemas[$ref] ??= {};
|
|
33
|
+
|
|
34
|
+
const oneOf: ArraySchema<Version>[] = factory();
|
|
35
|
+
Object.assign(
|
|
36
|
+
props.components.schemas[$ref]!,
|
|
37
|
+
oneOf.length === 1 ? oneOf[0] : { oneOf },
|
|
38
|
+
);
|
|
39
|
+
return out();
|
|
40
|
+
}
|
|
41
|
+
return factory();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
type ArraySchema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
48
|
+
? OpenApiV3.IJsonSchema.IArray
|
|
49
|
+
: OpenApi.IJsonSchema.IArray;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
type Schema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
55
|
+
? OpenApiV3.IJsonSchema
|
|
56
|
+
: OpenApi.IJsonSchema;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { MetadataAtomic } from "../../schemas/metadata/MetadataAtomic";
|
|
4
|
-
|
|
5
|
-
import { application_plugin } from "./application_plugin";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export const application_bigint = <Version extends "3.0" | "3.1">(
|
|
11
|
-
atomic: MetadataAtomic,
|
|
12
|
-
): Schema<Version>[] =>
|
|
13
|
-
application_plugin({
|
|
14
|
-
schema: {
|
|
15
|
-
type: "integer",
|
|
16
|
-
} satisfies Schema<Version>,
|
|
17
|
-
tags: atomic.tags,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
type Schema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
24
|
-
? OpenApiV3.IJsonSchema.IInteger
|
|
25
|
-
: OpenApi.IJsonSchema.IInteger;
|
|
1
|
+
import { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { MetadataAtomic } from "../../schemas/metadata/MetadataAtomic";
|
|
4
|
+
|
|
5
|
+
import { application_plugin } from "./application_plugin";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export const application_bigint = <Version extends "3.0" | "3.1">(
|
|
11
|
+
atomic: MetadataAtomic,
|
|
12
|
+
): Schema<Version>[] =>
|
|
13
|
+
application_plugin({
|
|
14
|
+
schema: {
|
|
15
|
+
type: "integer",
|
|
16
|
+
} satisfies Schema<Version>,
|
|
17
|
+
tags: atomic.tags,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
type Schema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
24
|
+
? OpenApiV3.IJsonSchema.IInteger
|
|
25
|
+
: OpenApi.IJsonSchema.IInteger;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { MetadataAtomic } from "../../schemas/metadata/MetadataAtomic";
|
|
4
|
-
|
|
5
|
-
import { application_plugin } from "./application_plugin";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export const application_boolean = <Version extends "3.0" | "3.1">(
|
|
11
|
-
atomic: MetadataAtomic,
|
|
12
|
-
): Schema<Version>[] =>
|
|
13
|
-
application_plugin({
|
|
14
|
-
schema: {
|
|
15
|
-
type: "boolean",
|
|
16
|
-
} satisfies Schema<Version>,
|
|
17
|
-
tags: atomic.tags,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
type Schema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
24
|
-
? OpenApiV3.IJsonSchema.IBoolean
|
|
25
|
-
: OpenApi.IJsonSchema.IBoolean;
|
|
1
|
+
import { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { MetadataAtomic } from "../../schemas/metadata/MetadataAtomic";
|
|
4
|
+
|
|
5
|
+
import { application_plugin } from "./application_plugin";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export const application_boolean = <Version extends "3.0" | "3.1">(
|
|
11
|
+
atomic: MetadataAtomic,
|
|
12
|
+
): Schema<Version>[] =>
|
|
13
|
+
application_plugin({
|
|
14
|
+
schema: {
|
|
15
|
+
type: "boolean",
|
|
16
|
+
} satisfies Schema<Version>,
|
|
17
|
+
tags: atomic.tags,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
type Schema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
24
|
+
? OpenApiV3.IJsonSchema.IBoolean
|
|
25
|
+
: OpenApi.IJsonSchema.IBoolean;
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
4
|
-
import { MetadataEscaped } from "../../schemas/metadata/MetadataEscaped";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export const application_escaped = <Version extends "3.0" | "3.1">(props: {
|
|
10
|
-
generator: (meta: Metadata) => Schema<Version>;
|
|
11
|
-
escaped: MetadataEscaped;
|
|
12
|
-
}): Schema<Version>[] => {
|
|
13
|
-
const output: Schema<Version> | null = props.generator(props.escaped.returns);
|
|
14
|
-
if (output === null) return [];
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
is_date({
|
|
18
|
-
visited: new Set(),
|
|
19
|
-
metadata: props.escaped.original,
|
|
20
|
-
})
|
|
21
|
-
) {
|
|
22
|
-
const string: StringSchema<Version> | undefined = is_string(output)
|
|
23
|
-
? output
|
|
24
|
-
: is_one_of(output)
|
|
25
|
-
? (output.oneOf.find(is_string) as StringSchema<Version>)
|
|
26
|
-
: undefined;
|
|
27
|
-
if (
|
|
28
|
-
string !== undefined &&
|
|
29
|
-
string.format !== "date" &&
|
|
30
|
-
string.format !== "date-time"
|
|
31
|
-
)
|
|
32
|
-
string.format = "date-time";
|
|
33
|
-
}
|
|
34
|
-
return is_one_of(output) ? (output.oneOf as Schema<Version>[]) : [output];
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
const is_string = <Version extends "3.0" | "3.1">(
|
|
41
|
-
schema: Schema<Version>,
|
|
42
|
-
): schema is StringSchema<Version> =>
|
|
43
|
-
(schema as StringSchema<Version>).type === "string";
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
const is_one_of = <Version extends "3.0" | "3.1">(
|
|
49
|
-
schema: Schema<Version>,
|
|
50
|
-
): schema is OneOfSchema<Version> =>
|
|
51
|
-
Array.isArray((schema as OneOfSchema<Version>).oneOf);
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
const is_date = (props: {
|
|
57
|
-
visited: Set<Metadata>;
|
|
58
|
-
metadata: Metadata;
|
|
59
|
-
}): boolean => {
|
|
60
|
-
if (props.visited.has(props.metadata)) return false;
|
|
61
|
-
props.visited.add(props.metadata);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
props.metadata.natives.some((name) => name === "Date") ||
|
|
65
|
-
props.metadata.arrays.some((array) =>
|
|
66
|
-
is_date({
|
|
67
|
-
visited: props.visited,
|
|
68
|
-
metadata: array.type.value,
|
|
69
|
-
}),
|
|
70
|
-
) ||
|
|
71
|
-
props.metadata.tuples.some((tuple) =>
|
|
72
|
-
tuple.type.elements.some((e) =>
|
|
73
|
-
is_date({
|
|
74
|
-
visited: props.visited,
|
|
75
|
-
metadata: e,
|
|
76
|
-
}),
|
|
77
|
-
),
|
|
78
|
-
) ||
|
|
79
|
-
props.metadata.aliases.some((alias) =>
|
|
80
|
-
is_date({
|
|
81
|
-
visited: props.visited,
|
|
82
|
-
metadata: alias.value,
|
|
83
|
-
}),
|
|
84
|
-
)
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
type Schema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
89
|
-
? OpenApiV3.IJsonSchema
|
|
90
|
-
: OpenApi.IJsonSchema;
|
|
91
|
-
type StringSchema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
92
|
-
? OpenApiV3.IJsonSchema.IString
|
|
93
|
-
: OpenApi.IJsonSchema.IString;
|
|
94
|
-
type OneOfSchema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
95
|
-
? OpenApiV3.IJsonSchema.IOneOf
|
|
96
|
-
: OpenApi.IJsonSchema.IOneOf;
|
|
1
|
+
import { OpenApi, OpenApiV3 } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
4
|
+
import { MetadataEscaped } from "../../schemas/metadata/MetadataEscaped";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export const application_escaped = <Version extends "3.0" | "3.1">(props: {
|
|
10
|
+
generator: (meta: Metadata) => Schema<Version>;
|
|
11
|
+
escaped: MetadataEscaped;
|
|
12
|
+
}): Schema<Version>[] => {
|
|
13
|
+
const output: Schema<Version> | null = props.generator(props.escaped.returns);
|
|
14
|
+
if (output === null) return [];
|
|
15
|
+
|
|
16
|
+
if (
|
|
17
|
+
is_date({
|
|
18
|
+
visited: new Set(),
|
|
19
|
+
metadata: props.escaped.original,
|
|
20
|
+
})
|
|
21
|
+
) {
|
|
22
|
+
const string: StringSchema<Version> | undefined = is_string(output)
|
|
23
|
+
? output
|
|
24
|
+
: is_one_of(output)
|
|
25
|
+
? (output.oneOf.find(is_string) as StringSchema<Version>)
|
|
26
|
+
: undefined;
|
|
27
|
+
if (
|
|
28
|
+
string !== undefined &&
|
|
29
|
+
string.format !== "date" &&
|
|
30
|
+
string.format !== "date-time"
|
|
31
|
+
)
|
|
32
|
+
string.format = "date-time";
|
|
33
|
+
}
|
|
34
|
+
return is_one_of(output) ? (output.oneOf as Schema<Version>[]) : [output];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
const is_string = <Version extends "3.0" | "3.1">(
|
|
41
|
+
schema: Schema<Version>,
|
|
42
|
+
): schema is StringSchema<Version> =>
|
|
43
|
+
(schema as StringSchema<Version>).type === "string";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
const is_one_of = <Version extends "3.0" | "3.1">(
|
|
49
|
+
schema: Schema<Version>,
|
|
50
|
+
): schema is OneOfSchema<Version> =>
|
|
51
|
+
Array.isArray((schema as OneOfSchema<Version>).oneOf);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
const is_date = (props: {
|
|
57
|
+
visited: Set<Metadata>;
|
|
58
|
+
metadata: Metadata;
|
|
59
|
+
}): boolean => {
|
|
60
|
+
if (props.visited.has(props.metadata)) return false;
|
|
61
|
+
props.visited.add(props.metadata);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
props.metadata.natives.some((name) => name === "Date") ||
|
|
65
|
+
props.metadata.arrays.some((array) =>
|
|
66
|
+
is_date({
|
|
67
|
+
visited: props.visited,
|
|
68
|
+
metadata: array.type.value,
|
|
69
|
+
}),
|
|
70
|
+
) ||
|
|
71
|
+
props.metadata.tuples.some((tuple) =>
|
|
72
|
+
tuple.type.elements.some((e) =>
|
|
73
|
+
is_date({
|
|
74
|
+
visited: props.visited,
|
|
75
|
+
metadata: e,
|
|
76
|
+
}),
|
|
77
|
+
),
|
|
78
|
+
) ||
|
|
79
|
+
props.metadata.aliases.some((alias) =>
|
|
80
|
+
is_date({
|
|
81
|
+
visited: props.visited,
|
|
82
|
+
metadata: alias.value,
|
|
83
|
+
}),
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
type Schema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
89
|
+
? OpenApiV3.IJsonSchema
|
|
90
|
+
: OpenApi.IJsonSchema;
|
|
91
|
+
type StringSchema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
92
|
+
? OpenApiV3.IJsonSchema.IString
|
|
93
|
+
: OpenApi.IJsonSchema.IString;
|
|
94
|
+
type OneOfSchema<Version extends "3.0" | "3.1"> = Version extends "3.0"
|
|
95
|
+
? OpenApiV3.IJsonSchema.IOneOf
|
|
96
|
+
: OpenApi.IJsonSchema.IOneOf;
|