typia 7.0.0-dev.20241022 → 7.0.0-dev.20241022-3
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/internal/{$httpFormdataReadArray.js → $httpFormDataReadArray.js} +1 -1
- package/lib/internal/$httpFormDataReadArray.js.map +1 -0
- package/lib/programmers/RandomProgrammer.js +10 -19
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/internal/json_schema_alias.d.ts +7 -0
- package/lib/programmers/internal/{application_v31_alias.js → json_schema_alias.js} +12 -15
- package/lib/programmers/internal/json_schema_alias.js.map +1 -0
- package/lib/programmers/internal/json_schema_array.d.ts +6 -0
- package/lib/programmers/internal/{application_array.js → json_schema_array.js} +13 -10
- package/lib/programmers/internal/json_schema_array.js.map +1 -0
- package/lib/programmers/internal/json_schema_bigint.d.ts +3 -0
- package/lib/programmers/internal/json_schema_bigint.js +14 -0
- package/lib/programmers/internal/json_schema_bigint.js.map +1 -0
- package/lib/programmers/internal/json_schema_boolean.d.ts +3 -0
- package/lib/programmers/internal/json_schema_boolean.js +14 -0
- package/lib/programmers/internal/json_schema_boolean.js.map +1 -0
- package/lib/programmers/internal/json_schema_constant.d.ts +3 -0
- package/lib/programmers/internal/json_schema_constant.js +25 -0
- package/lib/programmers/internal/json_schema_constant.js.map +1 -0
- package/lib/programmers/internal/json_schema_description.d.ts +5 -0
- package/lib/programmers/internal/{application_description.js → json_schema_description.js} +4 -4
- package/lib/programmers/internal/{application_description.js.map → json_schema_description.js.map} +1 -1
- package/lib/programmers/internal/json_schema_discriminator.d.ts +3 -0
- package/lib/programmers/internal/{application_union_discriminator.js → json_schema_discriminator.js} +4 -4
- package/lib/programmers/internal/json_schema_discriminator.js.map +1 -0
- package/lib/programmers/internal/{application_escaped.js → json_schema_escaped.js} +18 -21
- package/lib/programmers/internal/json_schema_escaped.js.map +1 -0
- package/lib/programmers/internal/json_schema_native.d.ts +6 -0
- package/lib/programmers/internal/{application_v31_native.js → json_schema_native.js} +7 -10
- package/lib/programmers/internal/json_schema_native.js.map +1 -0
- package/lib/programmers/internal/json_schema_number.d.ts +3 -0
- package/lib/programmers/internal/json_schema_number.js +14 -0
- package/lib/programmers/internal/json_schema_number.js.map +1 -0
- package/lib/programmers/internal/{application_v31_object.js → json_schema_object.js} +14 -14
- package/lib/programmers/internal/json_schema_object.js.map +1 -0
- package/lib/programmers/internal/json_schema_plugin.d.ts +6 -0
- package/lib/programmers/internal/{application_plugin.js → json_schema_plugin.js} +4 -7
- package/lib/programmers/internal/json_schema_plugin.js.map +1 -0
- package/lib/programmers/internal/json_schema_station.d.ts +8 -0
- package/lib/programmers/internal/{application_v31_schema.js → json_schema_station.js} +42 -67
- package/lib/programmers/internal/json_schema_station.js.map +1 -0
- package/lib/programmers/internal/json_schema_string.d.ts +3 -0
- package/lib/programmers/internal/json_schema_string.js +14 -0
- package/lib/programmers/internal/json_schema_string.js.map +1 -0
- package/lib/programmers/internal/json_schema_template.d.ts +3 -0
- package/lib/programmers/internal/{application_templates.js → json_schema_template.js} +34 -12
- package/lib/programmers/internal/json_schema_template.js.map +1 -0
- package/lib/programmers/internal/json_schema_title.d.ts +5 -0
- package/lib/programmers/internal/{application_title.js → json_schema_title.js} +4 -4
- package/lib/programmers/internal/{application_title.js.map → json_schema_title.js.map} +1 -1
- package/lib/programmers/internal/json_schema_tuple.d.ts +6 -0
- package/lib/programmers/internal/json_schema_tuple.js +32 -0
- package/lib/programmers/internal/json_schema_tuple.js.map +1 -0
- package/lib/programmers/json/JsonApplicationProgrammer.js +4 -1
- package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
- package/lib/programmers/json/JsonSchemasProgrammer.d.ts +4 -1
- package/lib/programmers/json/JsonSchemasProgrammer.js +14 -26
- package/lib/programmers/json/JsonSchemasProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.js +12 -5
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/transformers/features/json/JsonSchemasTransformer.js +4 -1
- package/lib/transformers/features/json/JsonSchemasTransformer.js.map +1 -1
- package/package.json +1 -1
- package/src/programmers/RandomProgrammer.ts +10 -18
- package/src/programmers/internal/{application_v31_alias.ts → json_schema_alias.ts} +9 -12
- package/src/programmers/internal/json_schema_array.ts +41 -0
- package/src/programmers/internal/json_schema_bigint.ts +15 -0
- package/src/programmers/internal/json_schema_boolean.ts +15 -0
- package/src/programmers/internal/{application_v31_constant.ts → json_schema_constant.ts} +7 -10
- package/src/programmers/internal/{application_description.ts → json_schema_description.ts} +12 -12
- package/src/programmers/internal/{application_union_discriminator.ts → json_schema_discriminator.ts} +1 -1
- package/src/programmers/internal/{llm_schema_escaped.ts → json_schema_escaped.ts} +25 -27
- package/src/programmers/internal/{application_v31_native.ts → json_schema_native.ts} +4 -7
- package/src/programmers/internal/json_schema_number.ts +15 -0
- package/src/programmers/internal/{application_v31_object.ts → json_schema_object.ts} +13 -13
- package/src/programmers/internal/{application_plugin.ts → json_schema_plugin.ts} +3 -4
- package/src/programmers/internal/json_schema_station.ts +182 -0
- package/src/programmers/internal/json_schema_string.ts +15 -0
- package/src/programmers/internal/{application_templates.ts → json_schema_template.ts} +11 -20
- package/src/programmers/internal/{application_title.ts → json_schema_title.ts} +20 -20
- package/src/programmers/internal/json_schema_tuple.ts +35 -0
- package/src/programmers/json/JsonApplicationProgrammer.ts +5 -4
- package/src/programmers/json/JsonSchemasProgrammer.ts +23 -26
- package/src/programmers/llm/LlmApplicationProgrammer.ts +1 -1
- package/src/programmers/llm/LlmSchemaProgrammer.ts +16 -6
- package/src/transformers/features/json/JsonSchemasTransformer.ts +4 -2
- package/lib/internal/$httpFormdataReadArray.js.map +0 -1
- package/lib/programmers/internal/application_array.js.map +0 -1
- package/lib/programmers/internal/application_bigint.js +0 -17
- package/lib/programmers/internal/application_bigint.js.map +0 -1
- package/lib/programmers/internal/application_boolean.d.ts +0 -1
- package/lib/programmers/internal/application_boolean.js +0 -17
- package/lib/programmers/internal/application_boolean.js.map +0 -1
- package/lib/programmers/internal/application_description.d.ts +0 -5
- package/lib/programmers/internal/application_escaped.d.ts +0 -1
- package/lib/programmers/internal/application_escaped.js.map +0 -1
- package/lib/programmers/internal/application_number.d.ts +0 -1
- package/lib/programmers/internal/application_number.js +0 -17
- package/lib/programmers/internal/application_number.js.map +0 -1
- package/lib/programmers/internal/application_plugin.d.ts +0 -1
- package/lib/programmers/internal/application_plugin.js.map +0 -1
- package/lib/programmers/internal/application_string.d.ts +0 -1
- package/lib/programmers/internal/application_string.js +0 -17
- package/lib/programmers/internal/application_string.js.map +0 -1
- package/lib/programmers/internal/application_templates.d.ts +0 -1
- package/lib/programmers/internal/application_templates.js.map +0 -1
- package/lib/programmers/internal/application_title.d.ts +0 -5
- package/lib/programmers/internal/application_union_discriminator.d.ts +0 -3
- package/lib/programmers/internal/application_union_discriminator.js.map +0 -1
- package/lib/programmers/internal/application_v30_alias.d.ts +0 -1
- package/lib/programmers/internal/application_v30_alias.js +0 -55
- package/lib/programmers/internal/application_v30_alias.js.map +0 -1
- package/lib/programmers/internal/application_v30_constant.d.ts +0 -1
- package/lib/programmers/internal/application_v30_constant.js +0 -13
- package/lib/programmers/internal/application_v30_constant.js.map +0 -1
- package/lib/programmers/internal/application_v30_native.d.ts +0 -1
- package/lib/programmers/internal/application_v30_native.js +0 -37
- package/lib/programmers/internal/application_v30_native.js.map +0 -1
- package/lib/programmers/internal/application_v30_object.d.ts +0 -1
- package/lib/programmers/internal/application_v30_object.js +0 -171
- package/lib/programmers/internal/application_v30_object.js.map +0 -1
- package/lib/programmers/internal/application_v30_schema.d.ts +0 -1
- package/lib/programmers/internal/application_v30_schema.js +0 -281
- package/lib/programmers/internal/application_v30_schema.js.map +0 -1
- package/lib/programmers/internal/application_v30_tuple.d.ts +0 -1
- package/lib/programmers/internal/application_v30_tuple.js +0 -34
- package/lib/programmers/internal/application_v30_tuple.js.map +0 -1
- package/lib/programmers/internal/application_v31_alias.d.ts +0 -1
- package/lib/programmers/internal/application_v31_alias.js.map +0 -1
- package/lib/programmers/internal/application_v31_constant.d.ts +0 -1
- package/lib/programmers/internal/application_v31_constant.js +0 -28
- package/lib/programmers/internal/application_v31_constant.js.map +0 -1
- package/lib/programmers/internal/application_v31_native.d.ts +0 -1
- package/lib/programmers/internal/application_v31_native.js.map +0 -1
- package/lib/programmers/internal/application_v31_object.d.ts +0 -1
- package/lib/programmers/internal/application_v31_object.js.map +0 -1
- package/lib/programmers/internal/application_v31_schema.d.ts +0 -1
- package/lib/programmers/internal/application_v31_schema.js.map +0 -1
- package/lib/programmers/internal/application_v31_tuple.d.ts +0 -1
- package/lib/programmers/internal/application_v31_tuple.js +0 -20
- package/lib/programmers/internal/application_v31_tuple.js.map +0 -1
- package/lib/programmers/internal/llm_schema_array.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_array.js +0 -23
- package/lib/programmers/internal/llm_schema_array.js.map +0 -1
- package/lib/programmers/internal/llm_schema_escaped.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_escaped.js +0 -74
- package/lib/programmers/internal/llm_schema_escaped.js.map +0 -1
- package/lib/programmers/internal/llm_schema_native.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_native.js +0 -19
- package/lib/programmers/internal/llm_schema_native.js.map +0 -1
- package/lib/programmers/internal/llm_schema_object.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_object.js +0 -141
- package/lib/programmers/internal/llm_schema_object.js.map +0 -1
- package/lib/programmers/internal/llm_schema_station.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_station.js +0 -241
- package/lib/programmers/internal/llm_schema_station.js.map +0 -1
- package/lib/programmers/internal/llm_schema_tuple.d.ts +0 -1
- package/lib/programmers/internal/llm_schema_tuple.js +0 -33
- package/lib/programmers/internal/llm_schema_tuple.js.map +0 -1
- package/src/programmers/internal/application_array.ts +0 -56
- package/src/programmers/internal/application_bigint.ts +0 -25
- package/src/programmers/internal/application_boolean.ts +0 -25
- package/src/programmers/internal/application_escaped.ts +0 -96
- package/src/programmers/internal/application_number.ts +0 -25
- package/src/programmers/internal/application_string.ts +0 -25
- package/src/programmers/internal/application_v30_alias.ts +0 -65
- package/src/programmers/internal/application_v30_constant.ts +0 -18
- package/src/programmers/internal/application_v30_native.ts +0 -39
- package/src/programmers/internal/application_v30_object.ts +0 -180
- package/src/programmers/internal/application_v30_schema.ts +0 -217
- package/src/programmers/internal/application_v30_tuple.ts +0 -33
- package/src/programmers/internal/application_v31_schema.ts +0 -212
- package/src/programmers/internal/application_v31_tuple.ts +0 -22
- package/src/programmers/internal/llm_schema_array.ts +0 -22
- package/src/programmers/internal/llm_schema_native.ts +0 -17
- package/src/programmers/internal/llm_schema_object.ts +0 -135
- package/src/programmers/internal/llm_schema_station.ts +0 -188
- package/src/programmers/internal/llm_schema_tuple.ts +0 -31
- /package/lib/internal/{$httpFormdataReadArray.d.ts → $httpFormDataReadArray.d.ts} +0 -0
- /package/lib/programmers/internal/{application_array.d.ts → json_schema_escaped.d.ts} +0 -0
- /package/lib/programmers/internal/{application_bigint.d.ts → json_schema_object.d.ts} +0 -0
- /package/src/internal/{$httpFormdataReadArray.ts → $httpFormDataReadArray.ts} +0 -0
|
@@ -12,10 +12,10 @@ var __values = (this && this.__values) || function(o) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.JsonSchemasProgrammer = void 0;
|
|
15
|
+
var OpenApiV3Downgrader_1 = require("@samchon/openapi/lib/converters/OpenApiV3Downgrader");
|
|
15
16
|
var TransformerError_1 = require("../../transformers/TransformerError");
|
|
16
17
|
var AtomicPredicator_1 = require("../helpers/AtomicPredicator");
|
|
17
|
-
var
|
|
18
|
-
var application_v31_schema_1 = require("../internal/application_v31_schema");
|
|
18
|
+
var json_schema_station_1 = require("../internal/json_schema_station");
|
|
19
19
|
var JsonSchemasProgrammer;
|
|
20
20
|
(function (JsonSchemasProgrammer) {
|
|
21
21
|
JsonSchemasProgrammer.validate = function (metadata) {
|
|
@@ -52,39 +52,27 @@ var JsonSchemasProgrammer;
|
|
|
52
52
|
}
|
|
53
53
|
return output;
|
|
54
54
|
};
|
|
55
|
-
JsonSchemasProgrammer.write = function (
|
|
56
|
-
return version === "3.0"
|
|
55
|
+
JsonSchemasProgrammer.write = function (props) {
|
|
56
|
+
return props.version === "3.0"
|
|
57
|
+
? writeV3_0(props.metadatas)
|
|
58
|
+
: writeV3_1(props.metadatas);
|
|
57
59
|
};
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
blockNever: true,
|
|
63
|
-
components: components,
|
|
64
|
-
attribute: {},
|
|
65
|
-
metadata: metadata,
|
|
66
|
-
});
|
|
67
|
-
};
|
|
60
|
+
var writeV3_0 = function (medadataList) {
|
|
61
|
+
var collection = writeV3_1(medadataList);
|
|
62
|
+
var asset = OpenApiV3Downgrader_1.OpenApiV3Downgrader.downgradeComponents(collection.components);
|
|
63
|
+
var caster = OpenApiV3Downgrader_1.OpenApiV3Downgrader.downgradeSchema(asset);
|
|
68
64
|
return {
|
|
69
65
|
version: "3.0",
|
|
70
|
-
components:
|
|
71
|
-
schemas:
|
|
72
|
-
var schema = generator(meta);
|
|
73
|
-
if (schema === null)
|
|
74
|
-
throw new TransformerError_1.TransformerError({
|
|
75
|
-
code: "typia.json.application",
|
|
76
|
-
message: "invalid type on argument - (".concat(meta.getName(), ", ").concat(i, ")"),
|
|
77
|
-
});
|
|
78
|
-
return schema;
|
|
79
|
-
}),
|
|
66
|
+
components: asset.downgraded,
|
|
67
|
+
schemas: collection.schemas.map(caster),
|
|
80
68
|
};
|
|
81
69
|
};
|
|
82
|
-
var
|
|
70
|
+
var writeV3_1 = function (metadataList) {
|
|
83
71
|
var components = {
|
|
84
72
|
schemas: {},
|
|
85
73
|
};
|
|
86
74
|
var generator = function (metadata) {
|
|
87
|
-
return (0,
|
|
75
|
+
return (0, json_schema_station_1.json_schema_station)({
|
|
88
76
|
blockNever: true,
|
|
89
77
|
components: components,
|
|
90
78
|
attribute: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonSchemasProgrammer.js","sourceRoot":"","sources":["../../../src/programmers/json/JsonSchemasProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"JsonSchemasProgrammer.js","sourceRoot":"","sources":["../../../src/programmers/json/JsonSchemasProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,2FAA0F;AAK1F,wEAAuE;AAEvE,gEAA+D;AAC/D,uEAAsE;AAEtE,IAAiB,qBAAqB,CA+ErC;AA/ED,WAAiB,qBAAqB;IACvB,8BAAQ,GAAG,UAAC,QAAkB;;QACzC,IAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IACE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAnB,CAAmB,CAAC;YACjD,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAnB,CAAmB,CAAC;YAEnD,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC3D,IACE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC;YACrB,OAAA,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,UAAU,EAAE,KAAK,KAAK,EAAxB,CAAwB,CAAC;QAArD,CAAqD,CACtD;YACD,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,KAAK,EAAnC,CAAmC,CAAC;YAEhE,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;QACvE,IAAI,QAAQ,C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A6B;QAE7B,IAAM,UAAU,GAAwB;YACtC,OAAO,EAAE,EAAE;SACZ,CAAC;QACF,IAAM,SAAS,GAAG,UAAC,QAAkB;YACnC,OAAA,IAAA,yCAAmB,EAAC;gBAClB,UAAU,EAAE,IAAI;gBAChB,UAAU,YAAA;gBACV,SAAS,EAAE,EAAE;gBACb,QAAQ,UAAA;aACT,CAAC;QALF,CAKE,CAAC;QACL,OAAO;YACL,OAAO,EAAE,KAAK;YACd,UAAU,YAAA;YACV,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,UAAC,IAAI,EAAE,CAAC;gBAChC,IAAM,MAAM,GAA+B,SAAS,CAAC,IAAI,CAAC,CAAC;gBAC3D,IAAI,MAAM,KAAK,IAAI;oBACjB,MAAM,IAAI,mCAAgB,CAAC;wBACzB,IAAI,EAAE,wBAAwB;wBAC9B,OAAO,EAAE,sCAA+B,IAAI,CAAC,OAAO,EAAE,eAAK,CAAC,MAAG;qBAChE,CAAC,CAAC;gBACL,OAAO,MAAM,CAAC;YAChB,CAAC,CAAC;SACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,EA/EgB,qBAAqB,qCAArB,qBAAqB,QA+ErC"}
|
|
@@ -12,8 +12,9 @@ var __values = (this && this.__values) || function(o) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.LlmSchemaProgrammer = void 0;
|
|
15
|
+
var HttpLlmConverter_1 = require("@samchon/openapi/lib/converters/HttpLlmConverter");
|
|
15
16
|
var AtomicPredicator_1 = require("../helpers/AtomicPredicator");
|
|
16
|
-
var
|
|
17
|
+
var JsonSchemasProgrammer_1 = require("../json/JsonSchemasProgrammer");
|
|
17
18
|
var LlmSchemaProgrammer;
|
|
18
19
|
(function (LlmSchemaProgrammer) {
|
|
19
20
|
LlmSchemaProgrammer.validate = function (metadata) {
|
|
@@ -56,11 +57,17 @@ var LlmSchemaProgrammer;
|
|
|
56
57
|
return output;
|
|
57
58
|
};
|
|
58
59
|
LlmSchemaProgrammer.write = function (metadata) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
attribute: {},
|
|
60
|
+
var collection = JsonSchemasProgrammer_1.JsonSchemasProgrammer.write({
|
|
61
|
+
version: "3.1",
|
|
62
|
+
metadatas: [metadata],
|
|
63
63
|
});
|
|
64
|
+
var schema = HttpLlmConverter_1.HttpLlmConverter.schema({
|
|
65
|
+
components: collection.components,
|
|
66
|
+
schema: collection.schemas[0],
|
|
67
|
+
});
|
|
68
|
+
if (schema === null)
|
|
69
|
+
throw new Error("Failed to convert JSON schema to LLM schema.");
|
|
70
|
+
return schema;
|
|
64
71
|
};
|
|
65
72
|
})(LlmSchemaProgrammer || (exports.LlmSchemaProgrammer = LlmSchemaProgrammer = {}));
|
|
66
73
|
//# sourceMappingURL=LlmSchemaProgrammer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmSchemaProgrammer.js","sourceRoot":"","sources":["../../../src/programmers/llm/LlmSchemaProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"LlmSchemaProgrammer.js","sourceRoot":"","sources":["../../../src/programmers/llm/LlmSchemaProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qFAAoF;AAKpF,gEAA+D;AAC/D,uEAAsE;AAEtE,IAAiB,mBAAmB,CAmDnC;AAnDD,WAAiB,mBAAmB;IACrB,4BAAQ,GAAG,UAAC,QAAkB;;QACzC,IAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IACE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAnB,CAAmB,CAAC;YACjD,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAnB,CAAmB,CAAC;YAEnD,MA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CAAC,SAAS,EAAhB,CAAgB,CAAC;YAC7C,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,CAAC,SAAS,EAAhB,CAAgB,CAAC;YAC9C,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,CAAC,SAAS,EAAhB,CAAgB,CAAC;YAE7C,MAAM,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAC7D,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEW,yBAAK,GAAG,UAAC,QAAkB;QACtC,IAAM,UAAU,GACd,6CAAqB,CAAC,KAAK,CAAC;YAC1B,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,CAAC,QAAQ,CAAC;SACtB,CAAC,CAAC;QACL,IAAM,MAAM,GAAsB,mCAAgB,CAAC,MAAM,CAAC;YACxD,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAE;SAC/B,CAAC,CAAC;QACH,IAAI,MAAM,KAAK,IAAI;YACjB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,EAnDgB,mBAAmB,mCAAnB,mBAAmB,QAmDnC"}
|
|
@@ -128,7 +128,10 @@ var JsonSchemasTransformer;
|
|
|
128
128
|
errors: errors,
|
|
129
129
|
});
|
|
130
130
|
// APPLICATION
|
|
131
|
-
var app = JsonSchemasProgrammer_1.JsonSchemasProgrammer.write(
|
|
131
|
+
var app = JsonSchemasProgrammer_1.JsonSchemasProgrammer.write({
|
|
132
|
+
version: version,
|
|
133
|
+
metadatas: metadatas,
|
|
134
|
+
});
|
|
132
135
|
return LiteralFactory_1.LiteralFactory.write(app);
|
|
133
136
|
};
|
|
134
137
|
var get_parameter = function (props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonSchemasTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/json/JsonSchemasTransformer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAE5B,oEAAmE;AACnE,4EAA2E;AAC3E,sEAAqE;AAKrE,yFAAwF;AAKxF,2DAA0D;AAE1D,IAAiB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"JsonSchemasTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/json/JsonSchemasTransformer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAE5B,oEAAmE;AACnE,4EAA2E;AAC3E,sEAAqE;AAKrE,yFAAwF;AAKxF,2DAA0D;AAE1D,IAAiB,sBAAsB,CAmHtC;AAnHD,WAAiB,sBAAsB;IACxB,gCAAS,GAAG,UACvB,KAAsD;;;QAEtD,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,UAAU,CAAC,aAAa,0CAAE,MAAM,CAAA;YACzC,MAAM,IAAI,mCAAgB,CAAC;gBACzB,IAAI,EAAE,wBAAwB;gBAC9B,OAAO,EAAE,sBAAsB;aAChC,CAAC,CAAC;QAEL,MAAM;QACN,gBAAgB;QAChB,MAAM;QACN,2BAA2B;QAC3B,IAAM,GAAG,GAAY,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAE,CAAC;QACxD,IAAI,CAAC,oBAAE,CAAC,eAAe,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC,UAAU,CAAC;aACjD,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC,oBAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAArB,CAAqB,CAAC;YAC1D,OAAO,KAAK,CAAC,UAAU,CAAC;QAE1B,YAAY;QACZ,IAAM,KAAK,GAAc,GAAG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AAE,6BAAqB,KAAK,CAAC,IAAI,yBAAqB;iBAC9D,CAAC,CAAC;YAEL,4BAA4B;YAC5B,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE;gBAC5B,CAAC,CAAC,IAAI,CAAC,KAAK;gBACZ,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK;gBACxD,MAAM,IAAI,mCAAgB,CAAC;oBACzB,IAAI,EAAE,wBAAwB;oBAC9B,OAAO,EAAE,8CAAsC,KAAK,CAAC,IAAI,QAAI;iBAC9D,CAAC,CAAC;YACL,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IAxBD,CAwBC,CAAC;AACN,CAAC,EAnHgB,sBAAsB,sCAAtB,sBAAsB,QAmHtC"}
|
package/package.json
CHANGED
|
@@ -30,12 +30,11 @@ import { StringUtil } from "../utils/StringUtil";
|
|
|
30
30
|
import { FeatureProgrammer } from "./FeatureProgrammer";
|
|
31
31
|
import { FunctionProgrammer } from "./helpers/FunctionProgrammer";
|
|
32
32
|
import { RandomJoiner } from "./helpers/RandomJoiner";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import { application_v31_schema } from "./internal/application_v31_schema";
|
|
33
|
+
import { json_schema_array } from "./internal/json_schema_array";
|
|
34
|
+
import { json_schema_bigint } from "./internal/json_schema_bigint";
|
|
35
|
+
import { json_schema_boolean } from "./internal/json_schema_boolean";
|
|
36
|
+
import { json_schema_number } from "./internal/json_schema_number";
|
|
37
|
+
import { json_schema_string } from "./internal/json_schema_string";
|
|
39
38
|
|
|
40
39
|
export namespace RandomProgrammer {
|
|
41
40
|
export interface IProps {
|
|
@@ -470,12 +469,12 @@ export namespace RandomProgrammer {
|
|
|
470
469
|
}) => {
|
|
471
470
|
const schemaList: OpenApi.IJsonSchema[] =
|
|
472
471
|
props.atomic.type === "boolean"
|
|
473
|
-
?
|
|
472
|
+
? json_schema_boolean(props.atomic)
|
|
474
473
|
: props.atomic.type === "string"
|
|
475
|
-
?
|
|
474
|
+
? json_schema_string(props.atomic)
|
|
476
475
|
: props.atomic.type === "bigint"
|
|
477
|
-
?
|
|
478
|
-
:
|
|
476
|
+
? json_schema_bigint(props.atomic)
|
|
477
|
+
: json_schema_number(props.atomic);
|
|
479
478
|
return schemaList.map((schema) => {
|
|
480
479
|
interface IComposed {
|
|
481
480
|
method: string;
|
|
@@ -577,14 +576,7 @@ export namespace RandomProgrammer {
|
|
|
577
576
|
array: MetadataArray;
|
|
578
577
|
}): ts.Expression[] => {
|
|
579
578
|
const components: OpenApi.IComponents = {};
|
|
580
|
-
const schemaList: OpenApi.IJsonSchema.IArray[] =
|
|
581
|
-
generator: (value) =>
|
|
582
|
-
application_v31_schema({
|
|
583
|
-
blockNever: true,
|
|
584
|
-
components,
|
|
585
|
-
attribute: {},
|
|
586
|
-
metadata: value,
|
|
587
|
-
})!,
|
|
579
|
+
const schemaList: OpenApi.IJsonSchema.IArray[] = json_schema_array({
|
|
588
580
|
components,
|
|
589
581
|
array: props.array,
|
|
590
582
|
}) as OpenApi.IJsonSchema.IArray[];
|
|
@@ -2,15 +2,12 @@ import { OpenApi } from "@samchon/openapi";
|
|
|
2
2
|
|
|
3
3
|
import { MetadataAlias } from "../../schemas/metadata/MetadataAlias";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { json_schema_description } from "./json_schema_description";
|
|
6
|
+
import { json_schema_object } from "./json_schema_object";
|
|
7
|
+
import { json_schema_station } from "./json_schema_station";
|
|
8
|
+
import { json_schema_title } from "./json_schema_title";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export const application_v31_alias = <BlockNever extends boolean>(props: {
|
|
10
|
+
export const json_schema_alias = <BlockNever extends boolean>(props: {
|
|
14
11
|
blockNever: BlockNever;
|
|
15
12
|
components: OpenApi.IComponents;
|
|
16
13
|
alias: MetadataAlias;
|
|
@@ -19,7 +16,7 @@ export const application_v31_alias = <BlockNever extends boolean>(props: {
|
|
|
19
16
|
props.alias.type.value.size() === 1 &&
|
|
20
17
|
props.alias.type.value.objects.length === 1
|
|
21
18
|
)
|
|
22
|
-
return
|
|
19
|
+
return json_schema_object({
|
|
23
20
|
components: props.components,
|
|
24
21
|
object: props.alias.type.value.objects[0]!,
|
|
25
22
|
}) as OpenApi.IJsonSchema.IReference[];
|
|
@@ -31,15 +28,15 @@ export const application_v31_alias = <BlockNever extends boolean>(props: {
|
|
|
31
28
|
props.components.schemas[props.alias.type.name] = {};
|
|
32
29
|
|
|
33
30
|
// GENERATE SCHEMA
|
|
34
|
-
const schema: OpenApi.IJsonSchema | null =
|
|
31
|
+
const schema: OpenApi.IJsonSchema | null = json_schema_station({
|
|
35
32
|
blockNever: props.blockNever,
|
|
36
33
|
components: props.components,
|
|
37
34
|
attribute: {
|
|
38
35
|
deprecated:
|
|
39
36
|
props.alias.type.jsDocTags.some((tag) => tag.name === "deprecated") ||
|
|
40
37
|
undefined,
|
|
41
|
-
title:
|
|
42
|
-
description:
|
|
38
|
+
title: json_schema_title(props.alias.type),
|
|
39
|
+
description: json_schema_description(props.alias.type),
|
|
43
40
|
},
|
|
44
41
|
metadata: props.alias.type.value,
|
|
45
42
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { MetadataArray } from "../../schemas/metadata/MetadataArray";
|
|
4
|
+
|
|
5
|
+
import { json_schema_plugin } from "./json_schema_plugin";
|
|
6
|
+
import { json_schema_station } from "./json_schema_station";
|
|
7
|
+
|
|
8
|
+
export const json_schema_array = (props: {
|
|
9
|
+
components: OpenApi.IComponents;
|
|
10
|
+
array: MetadataArray;
|
|
11
|
+
}): Array<OpenApi.IJsonSchema.IArray | OpenApi.IJsonSchema.IReference> => {
|
|
12
|
+
const factory = (): OpenApi.IJsonSchema.IArray[] =>
|
|
13
|
+
json_schema_plugin({
|
|
14
|
+
schema: {
|
|
15
|
+
type: "array",
|
|
16
|
+
items: json_schema_station({
|
|
17
|
+
blockNever: false,
|
|
18
|
+
components: props.components,
|
|
19
|
+
metadata: props.array.type.value,
|
|
20
|
+
attribute: {},
|
|
21
|
+
}),
|
|
22
|
+
} satisfies OpenApi.IJsonSchema.IArray,
|
|
23
|
+
tags: props.array.tags,
|
|
24
|
+
});
|
|
25
|
+
if (props.array.type.recursive === true) {
|
|
26
|
+
const out = () => [{ $ref }];
|
|
27
|
+
const $ref: string = `#/components/schemas/${props.array.type.name}`;
|
|
28
|
+
if (props.components.schemas?.[$ref] !== undefined) return out();
|
|
29
|
+
|
|
30
|
+
props.components.schemas ??= {};
|
|
31
|
+
props.components.schemas[$ref] ??= {};
|
|
32
|
+
|
|
33
|
+
const oneOf: OpenApi.IJsonSchema.IArray[] = factory();
|
|
34
|
+
Object.assign(
|
|
35
|
+
props.components.schemas[$ref]!,
|
|
36
|
+
oneOf.length === 1 ? oneOf[0] : { oneOf },
|
|
37
|
+
);
|
|
38
|
+
return out();
|
|
39
|
+
}
|
|
40
|
+
return factory();
|
|
41
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { MetadataAtomic } from "../../schemas/metadata/MetadataAtomic";
|
|
4
|
+
|
|
5
|
+
import { json_schema_plugin } from "./json_schema_plugin";
|
|
6
|
+
|
|
7
|
+
export const json_schema_bigint = (
|
|
8
|
+
atomic: MetadataAtomic,
|
|
9
|
+
): OpenApi.IJsonSchema.IInteger[] =>
|
|
10
|
+
json_schema_plugin({
|
|
11
|
+
schema: {
|
|
12
|
+
type: "integer",
|
|
13
|
+
} satisfies OpenApi.IJsonSchema.IInteger,
|
|
14
|
+
tags: atomic.tags,
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { MetadataAtomic } from "../../schemas/metadata/MetadataAtomic";
|
|
4
|
+
|
|
5
|
+
import { json_schema_plugin } from "./json_schema_plugin";
|
|
6
|
+
|
|
7
|
+
export const json_schema_boolean = (
|
|
8
|
+
atomic: MetadataAtomic,
|
|
9
|
+
): OpenApi.IJsonSchema.IBoolean[] =>
|
|
10
|
+
json_schema_plugin({
|
|
11
|
+
schema: {
|
|
12
|
+
type: "boolean",
|
|
13
|
+
} satisfies OpenApi.IJsonSchema.IBoolean,
|
|
14
|
+
tags: atomic.tags,
|
|
15
|
+
});
|
|
@@ -2,26 +2,23 @@ import { OpenApi } from "@samchon/openapi";
|
|
|
2
2
|
|
|
3
3
|
import { MetadataConstant } from "../../schemas/metadata/MetadataConstant";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { json_schema_description } from "./json_schema_description";
|
|
6
|
+
import { json_schema_plugin } from "./json_schema_plugin";
|
|
7
|
+
import { json_schema_title } from "./json_schema_title";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export const application_v31_constant = (
|
|
9
|
+
export const json_schema_constant = (
|
|
13
10
|
constant: MetadataConstant,
|
|
14
11
|
): OpenApi.IJsonSchema.IConstant[] =>
|
|
15
12
|
constant.values
|
|
16
13
|
.map((value) =>
|
|
17
|
-
|
|
14
|
+
json_schema_plugin({
|
|
18
15
|
schema: {
|
|
19
16
|
const:
|
|
20
17
|
typeof value.value === "bigint"
|
|
21
18
|
? Number(value.value)
|
|
22
19
|
: (value.value as boolean | number | string),
|
|
23
|
-
title:
|
|
24
|
-
description:
|
|
20
|
+
title: json_schema_title(value),
|
|
21
|
+
description: json_schema_description(value),
|
|
25
22
|
} satisfies OpenApi.IJsonSchema.IConstant,
|
|
26
23
|
tags: value.tags ?? [],
|
|
27
24
|
}),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IJsDocTagInfo } from "../../
|
|
2
|
-
|
|
3
|
-
export const
|
|
4
|
-
description?: string | null | undefined;
|
|
5
|
-
jsDocTags?: IJsDocTagInfo[];
|
|
6
|
-
}): string | undefined =>
|
|
7
|
-
props.jsDocTags
|
|
8
|
-
?.find((tag) => tag.name === "description")
|
|
9
|
-
?.text?.[0]?.text?.split("\r\n")
|
|
10
|
-
.join("\n") ??
|
|
11
|
-
props.description ??
|
|
12
|
-
undefined;
|
|
1
|
+
import { IJsDocTagInfo } from "../../schemas/metadata/IJsDocTagInfo";
|
|
2
|
+
|
|
3
|
+
export const json_schema_description = (props: {
|
|
4
|
+
description?: string | null | undefined;
|
|
5
|
+
jsDocTags?: IJsDocTagInfo[];
|
|
6
|
+
}): string | undefined =>
|
|
7
|
+
props.jsDocTags
|
|
8
|
+
?.find((tag) => tag.name === "description")
|
|
9
|
+
?.text?.[0]?.text?.split("\r\n")
|
|
10
|
+
.join("\n") ??
|
|
11
|
+
props.description ??
|
|
12
|
+
undefined;
|
package/src/programmers/internal/{application_union_discriminator.ts → json_schema_discriminator.ts}
RENAMED
|
@@ -4,7 +4,7 @@ import { Metadata } from "../../schemas/metadata/Metadata";
|
|
|
4
4
|
|
|
5
5
|
import { UnionPredicator } from "../helpers/UnionPredicator";
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const json_schema_discriminator = (
|
|
8
8
|
metadata: Metadata,
|
|
9
9
|
): OpenApi.IJsonSchema.IOneOf.IDiscriminator | undefined => {
|
|
10
10
|
if (
|
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OpenApi, OpenApiTypeChecker } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
4
4
|
import { MetadataEscaped } from "../../schemas/metadata/MetadataEscaped";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { json_schema_station } from "./json_schema_station";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const json_schema_escaped = (props: {
|
|
12
|
+
components: OpenApi.IComponents;
|
|
13
|
+
escaped: MetadataEscaped;
|
|
14
|
+
}): OpenApi.IJsonSchema[] => {
|
|
15
|
+
const output: OpenApi.IJsonSchema | null = json_schema_station({
|
|
14
16
|
blockNever: false,
|
|
17
|
+
components: props.components,
|
|
18
|
+
metadata: props.escaped.returns,
|
|
15
19
|
attribute: {},
|
|
16
20
|
});
|
|
17
21
|
if (output === null) return [];
|
|
18
|
-
|
|
22
|
+
|
|
23
|
+
if (
|
|
19
24
|
is_date({
|
|
20
25
|
visited: new Set(),
|
|
21
|
-
metadata: escaped.original,
|
|
26
|
+
metadata: props.escaped.original,
|
|
22
27
|
})
|
|
23
28
|
) {
|
|
24
|
-
const string:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
const string: OpenApi.IJsonSchema.IString | undefined =
|
|
30
|
+
OpenApiTypeChecker.isString(output)
|
|
31
|
+
? output
|
|
32
|
+
: OpenApiTypeChecker.isOneOf(output)
|
|
33
|
+
? (output.oneOf.find(
|
|
34
|
+
OpenApiTypeChecker.isString,
|
|
35
|
+
) as OpenApi.IJsonSchema.IString)
|
|
36
|
+
: undefined;
|
|
29
37
|
if (
|
|
30
38
|
string !== undefined &&
|
|
31
39
|
string.format !== "date" &&
|
|
@@ -33,21 +41,11 @@ export const llm_schema_escaped = (escaped: MetadataEscaped): ILlmSchema[] => {
|
|
|
33
41
|
)
|
|
34
42
|
string.format = "date-time";
|
|
35
43
|
}
|
|
36
|
-
return
|
|
44
|
+
return OpenApiTypeChecker.isOneOf(output)
|
|
45
|
+
? (output.oneOf as OpenApi.IJsonSchema[])
|
|
46
|
+
: [output];
|
|
37
47
|
};
|
|
38
48
|
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
const is_string = (elem: ILlmSchema): elem is ILlmSchema.IString =>
|
|
43
|
-
(elem as ILlmSchema.IString).type === "string";
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
const is_one_of = (elem: ILlmSchema): elem is ILlmSchema.IOneOf =>
|
|
49
|
-
Array.isArray((elem as ILlmSchema.IOneOf).oneOf);
|
|
50
|
-
|
|
51
49
|
/**
|
|
52
50
|
* @internal
|
|
53
51
|
*/
|
|
@@ -67,10 +65,10 @@ const is_date = (props: {
|
|
|
67
65
|
}),
|
|
68
66
|
) ||
|
|
69
67
|
props.metadata.tuples.some((tuple) =>
|
|
70
|
-
tuple.type.elements.some((
|
|
68
|
+
tuple.type.elements.some((e) =>
|
|
71
69
|
is_date({
|
|
72
70
|
visited: props.visited,
|
|
73
|
-
metadata:
|
|
71
|
+
metadata: e,
|
|
74
72
|
}),
|
|
75
73
|
),
|
|
76
74
|
) ||
|
|
@@ -2,17 +2,14 @@ import { OpenApi } from "@samchon/openapi";
|
|
|
2
2
|
|
|
3
3
|
import { MetadataNative } from "../../schemas/metadata/MetadataNative";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { json_schema_plugin } from "./json_schema_plugin";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export const application_v31_native = (props: {
|
|
7
|
+
export const json_schema_native = (props: {
|
|
11
8
|
components: OpenApi.IComponents;
|
|
12
9
|
native: MetadataNative;
|
|
13
10
|
}): OpenApi.IJsonSchema[] => {
|
|
14
11
|
if (props.native.name === "Blob" || props.native.name === "File")
|
|
15
|
-
return
|
|
12
|
+
return json_schema_plugin({
|
|
16
13
|
schema: {
|
|
17
14
|
type: "string",
|
|
18
15
|
format: "binary",
|
|
@@ -26,7 +23,7 @@ export const application_v31_native = (props: {
|
|
|
26
23
|
properties: {},
|
|
27
24
|
};
|
|
28
25
|
}
|
|
29
|
-
return
|
|
26
|
+
return json_schema_plugin({
|
|
30
27
|
schema: {
|
|
31
28
|
$ref: `#/components/schemas/${props.native.name}`,
|
|
32
29
|
},
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { MetadataAtomic } from "../../schemas/metadata/MetadataAtomic";
|
|
4
|
+
|
|
5
|
+
import { json_schema_plugin } from "./json_schema_plugin";
|
|
6
|
+
|
|
7
|
+
export const json_schema_number = (
|
|
8
|
+
atomic: MetadataAtomic,
|
|
9
|
+
): Array<OpenApi.IJsonSchema.IInteger | OpenApi.IJsonSchema.INumber> =>
|
|
10
|
+
json_schema_plugin({
|
|
11
|
+
schema: {
|
|
12
|
+
type: "number",
|
|
13
|
+
} satisfies OpenApi.IJsonSchema.INumber,
|
|
14
|
+
tags: atomic.tags,
|
|
15
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OpenApi
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
import { CommentFactory } from "../../factories/CommentFactory";
|
|
4
4
|
|
|
@@ -8,20 +8,20 @@ import { MetadataObject } from "../../schemas/metadata/MetadataObject";
|
|
|
8
8
|
|
|
9
9
|
import { PatternUtil } from "../../utils/PatternUtil";
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { json_schema_description } from "./json_schema_description";
|
|
12
|
+
import { json_schema_plugin } from "./json_schema_plugin";
|
|
13
|
+
import { json_schema_station } from "./json_schema_station";
|
|
14
|
+
import { json_schema_title } from "./json_schema_title";
|
|
15
15
|
import { metadata_to_pattern } from "./metadata_to_pattern";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
|
19
19
|
*/
|
|
20
|
-
export const
|
|
20
|
+
export const json_schema_object = (props: {
|
|
21
21
|
components: OpenApi.IComponents;
|
|
22
22
|
object: MetadataObject;
|
|
23
23
|
}): Array<OpenApi.IJsonSchema.IReference | OpenApi.IJsonSchema.IObject> =>
|
|
24
|
-
|
|
24
|
+
json_schema_plugin({
|
|
25
25
|
schema: emplace_object(props),
|
|
26
26
|
tags: props.object.tags,
|
|
27
27
|
});
|
|
@@ -37,7 +37,7 @@ const emplace_object = (props: {
|
|
|
37
37
|
const $ref: string = `#/components/schemas/${key}`;
|
|
38
38
|
if (props.components.schemas?.[key] !== undefined) return { $ref };
|
|
39
39
|
|
|
40
|
-
const lazy:
|
|
40
|
+
const lazy: OpenApi.IJsonSchema = {};
|
|
41
41
|
props.components.schemas ??= {};
|
|
42
42
|
props.components.schemas[key] = lazy;
|
|
43
43
|
Object.assign(lazy, create_object_schema(props));
|
|
@@ -71,15 +71,15 @@ const create_object_schema = (props: {
|
|
|
71
71
|
else if (property.jsDocTags.find((tag) => tag.name === "hidden")) continue; // THE HIDDEN TAG
|
|
72
72
|
|
|
73
73
|
const key: string | null = property.key.getSoleLiteral();
|
|
74
|
-
const schema: OpenApi.IJsonSchema | null =
|
|
74
|
+
const schema: OpenApi.IJsonSchema | null = json_schema_station({
|
|
75
75
|
blockNever: true,
|
|
76
76
|
components: props.components,
|
|
77
77
|
attribute: {
|
|
78
78
|
deprecated:
|
|
79
79
|
property.jsDocTags.some((tag) => tag.name === "deprecated") ||
|
|
80
80
|
undefined,
|
|
81
|
-
title:
|
|
82
|
-
description:
|
|
81
|
+
title: json_schema_title(property),
|
|
82
|
+
description: json_schema_description(property),
|
|
83
83
|
},
|
|
84
84
|
metadata: property.value,
|
|
85
85
|
});
|
|
@@ -109,7 +109,7 @@ const create_object_schema = (props: {
|
|
|
109
109
|
);
|
|
110
110
|
return info?.text?.length ? CommentFactory.merge(info.text) : undefined;
|
|
111
111
|
})(),
|
|
112
|
-
description:
|
|
112
|
+
description: json_schema_description(props.object.type),
|
|
113
113
|
additionalProperties: join({
|
|
114
114
|
components: props.components,
|
|
115
115
|
extra: extraMeta,
|
|
@@ -140,7 +140,7 @@ const join = (props: {
|
|
|
140
140
|
.map((tuple) => tuple[0])
|
|
141
141
|
.reduce((x, y) => Metadata.merge(x, y));
|
|
142
142
|
return (
|
|
143
|
-
|
|
143
|
+
json_schema_station({
|
|
144
144
|
blockNever: true,
|
|
145
145
|
components: props.components,
|
|
146
146
|
attribute: {},
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
|
+
|
|
1
3
|
import { IMetadataTypeTag } from "../../schemas/metadata/IMetadataTypeTag";
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export const application_plugin = <Schema extends object>(props: {
|
|
5
|
+
export const json_schema_plugin = <Schema extends OpenApi.IJsonSchema>(props: {
|
|
7
6
|
schema: Schema;
|
|
8
7
|
tags: IMetadataTypeTag[][];
|
|
9
8
|
}): Schema[] => {
|