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
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __values = (this && this.__values) || function(o) {
|
|
14
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
-
if (m) return m.call(o);
|
|
16
|
-
if (o && typeof o.length === "number") return {
|
|
17
|
-
next: function () {
|
|
18
|
-
if (o && i >= o.length) o = void 0;
|
|
19
|
-
return { value: o && o[i++], done: !o };
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.llm_schema_station = void 0;
|
|
26
|
-
var MetadataAtomic_1 = require("../../schemas/metadata/MetadataAtomic");
|
|
27
|
-
var AtomicPredicator_1 = require("../helpers/AtomicPredicator");
|
|
28
|
-
var application_bigint_1 = require("./application_bigint");
|
|
29
|
-
var application_boolean_1 = require("./application_boolean");
|
|
30
|
-
var application_number_1 = require("./application_number");
|
|
31
|
-
var application_string_1 = require("./application_string");
|
|
32
|
-
var application_templates_1 = require("./application_templates");
|
|
33
|
-
var application_v30_constant_1 = require("./application_v30_constant");
|
|
34
|
-
var llm_schema_array_1 = require("./llm_schema_array");
|
|
35
|
-
var llm_schema_escaped_1 = require("./llm_schema_escaped");
|
|
36
|
-
var llm_schema_native_1 = require("./llm_schema_native");
|
|
37
|
-
var llm_schema_object_1 = require("./llm_schema_object");
|
|
38
|
-
var llm_schema_tuple_1 = require("./llm_schema_tuple");
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
var llm_schema_station = function (props) {
|
|
43
|
-
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f, e_7, _g;
|
|
44
|
-
var _h, _j, _k;
|
|
45
|
-
// VULNERABLE CASE
|
|
46
|
-
if (props.metadata.any === true)
|
|
47
|
-
return __assign(__assign({}, props.attribute), { type: undefined });
|
|
48
|
-
else if (props.metadata.nullable === true && props.metadata.empty() === true)
|
|
49
|
-
return __assign(__assign({}, props.attribute), { type: "null" });
|
|
50
|
-
//----
|
|
51
|
-
// GATHER UNION SCHEMAS
|
|
52
|
-
//----
|
|
53
|
-
var union = [];
|
|
54
|
-
var insert = props.metadata.nullable
|
|
55
|
-
? function (schema) {
|
|
56
|
-
return union.push(__assign(__assign({}, schema), { nullable: schema.type
|
|
57
|
-
? true
|
|
58
|
-
: undefined }));
|
|
59
|
-
}
|
|
60
|
-
: function (schema) { return union.push(schema); };
|
|
61
|
-
// toJSON() METHOD
|
|
62
|
-
if (props.metadata.escaped !== null)
|
|
63
|
-
(0, llm_schema_escaped_1.llm_schema_escaped)(props.metadata.escaped).forEach(insert);
|
|
64
|
-
// ATOMIC TYPES
|
|
65
|
-
if (props.metadata.templates.length &&
|
|
66
|
-
AtomicPredicator_1.AtomicPredicator.template(props.metadata))
|
|
67
|
-
(0, application_templates_1.application_templates)(props.metadata).map(insert);
|
|
68
|
-
try {
|
|
69
|
-
for (var _l = __values(props.metadata.constants), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
70
|
-
var constant = _m.value;
|
|
71
|
-
if (AtomicPredicator_1.AtomicPredicator.constant({
|
|
72
|
-
metadata: props.metadata,
|
|
73
|
-
name: constant.type,
|
|
74
|
-
}) === false)
|
|
75
|
-
continue;
|
|
76
|
-
else
|
|
77
|
-
insert((0, application_v30_constant_1.application_v30_constant)(constant));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
81
|
-
finally {
|
|
82
|
-
try {
|
|
83
|
-
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
84
|
-
}
|
|
85
|
-
finally { if (e_1) throw e_1.error; }
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
for (var _o = __values(props.metadata.atomics), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
89
|
-
var a = _p.value;
|
|
90
|
-
if (a.type === "boolean")
|
|
91
|
-
(0, application_boolean_1.application_boolean)(a).forEach(insert);
|
|
92
|
-
else if (a.type === "bigint")
|
|
93
|
-
(0, application_bigint_1.application_bigint)(a).forEach(insert);
|
|
94
|
-
else if (a.type === "number")
|
|
95
|
-
(0, application_number_1.application_number)(a).forEach(insert);
|
|
96
|
-
else if (a.type === "string")
|
|
97
|
-
(0, application_string_1.application_string)(a).forEach(insert);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
101
|
-
finally {
|
|
102
|
-
try {
|
|
103
|
-
if (_p && !_p.done && (_b = _o.return)) _b.call(_o);
|
|
104
|
-
}
|
|
105
|
-
finally { if (e_2) throw e_2.error; }
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
// ARRAY
|
|
109
|
-
for (var _q = __values(props.metadata.arrays), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
110
|
-
var array = _r.value;
|
|
111
|
-
if (array.type.recursive)
|
|
112
|
-
throw new Error("Error on LlmSchemaProgrammer.write(): LLM schema does not allow recursive array type.");
|
|
113
|
-
else
|
|
114
|
-
(0, llm_schema_array_1.llm_schema_array)(array).forEach(insert);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
118
|
-
finally {
|
|
119
|
-
try {
|
|
120
|
-
if (_r && !_r.done && (_c = _q.return)) _c.call(_q);
|
|
121
|
-
}
|
|
122
|
-
finally { if (e_3) throw e_3.error; }
|
|
123
|
-
}
|
|
124
|
-
try {
|
|
125
|
-
// TUPLE
|
|
126
|
-
for (var _s = __values(props.metadata.tuples), _t = _s.next(); !_t.done; _t = _s.next()) {
|
|
127
|
-
var tuple = _t.value;
|
|
128
|
-
if (tuple.type.recursive)
|
|
129
|
-
throw new Error("Error on LlmSchemaProgrammer.write(): LLM schema does not allow recursive tuple type.");
|
|
130
|
-
else
|
|
131
|
-
insert((0, llm_schema_tuple_1.llm_schema_tuple)({
|
|
132
|
-
tuple: tuple,
|
|
133
|
-
attribute: props.attribute,
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
138
|
-
finally {
|
|
139
|
-
try {
|
|
140
|
-
if (_t && !_t.done && (_d = _s.return)) _d.call(_s);
|
|
141
|
-
}
|
|
142
|
-
finally { if (e_4) throw e_4.error; }
|
|
143
|
-
}
|
|
144
|
-
var _loop_1 = function (native) {
|
|
145
|
-
if (AtomicPredicator_1.AtomicPredicator.native(native.name)) {
|
|
146
|
-
var type_1 = native.name.toLowerCase();
|
|
147
|
-
if (props.metadata.atomics.some(function (a) { return a.type === type_1; }))
|
|
148
|
-
return "continue";
|
|
149
|
-
else if (type_1 === "boolean")
|
|
150
|
-
insert((0, application_boolean_1.application_boolean)(MetadataAtomic_1.MetadataAtomic.create({
|
|
151
|
-
type: "boolean",
|
|
152
|
-
tags: [],
|
|
153
|
-
}))[0]);
|
|
154
|
-
else if (type_1 === "bigint")
|
|
155
|
-
insert((0, application_bigint_1.application_bigint)(MetadataAtomic_1.MetadataAtomic.create({
|
|
156
|
-
type: "bigint",
|
|
157
|
-
tags: [],
|
|
158
|
-
}))[0]);
|
|
159
|
-
else if (type_1 === "number")
|
|
160
|
-
insert((0, application_number_1.application_number)(MetadataAtomic_1.MetadataAtomic.create({
|
|
161
|
-
type: "number",
|
|
162
|
-
tags: [],
|
|
163
|
-
}))[0]);
|
|
164
|
-
else if (type_1 === "string")
|
|
165
|
-
insert((0, application_string_1.application_string)(MetadataAtomic_1.MetadataAtomic.create({
|
|
166
|
-
type: "string",
|
|
167
|
-
tags: [],
|
|
168
|
-
}))[0]);
|
|
169
|
-
}
|
|
170
|
-
else
|
|
171
|
-
insert((0, llm_schema_native_1.llm_schema_native)(native.name));
|
|
172
|
-
};
|
|
173
|
-
try {
|
|
174
|
-
// NATIVES
|
|
175
|
-
for (var _u = __values(props.metadata.natives), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
176
|
-
var native = _v.value;
|
|
177
|
-
_loop_1(native);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
181
|
-
finally {
|
|
182
|
-
try {
|
|
183
|
-
if (_v && !_v.done && (_e = _u.return)) _e.call(_u);
|
|
184
|
-
}
|
|
185
|
-
finally { if (e_5) throw e_5.error; }
|
|
186
|
-
}
|
|
187
|
-
if (props.metadata.sets.length)
|
|
188
|
-
insert((0, llm_schema_native_1.llm_schema_native)("Set"));
|
|
189
|
-
if (props.metadata.maps.length)
|
|
190
|
-
insert((0, llm_schema_native_1.llm_schema_native)("Map"));
|
|
191
|
-
try {
|
|
192
|
-
// OBJECT
|
|
193
|
-
for (var _w = __values(props.metadata.objects), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
194
|
-
var object = _x.value;
|
|
195
|
-
if (object.type.recursive)
|
|
196
|
-
throw new Error("Error on LlmSchemaProgrammer.write(): LLM schema does not allow recursive object type.");
|
|
197
|
-
else
|
|
198
|
-
(0, llm_schema_object_1.llm_schema_object)({
|
|
199
|
-
object: object,
|
|
200
|
-
nullable: props.metadata.nullable,
|
|
201
|
-
}).forEach(insert);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
205
|
-
finally {
|
|
206
|
-
try {
|
|
207
|
-
if (_x && !_x.done && (_f = _w.return)) _f.call(_w);
|
|
208
|
-
}
|
|
209
|
-
finally { if (e_6) throw e_6.error; }
|
|
210
|
-
}
|
|
211
|
-
try {
|
|
212
|
-
// ALIASES
|
|
213
|
-
for (var _y = __values(props.metadata.aliases), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
214
|
-
var alias = _z.value;
|
|
215
|
-
if (alias.type.recursive)
|
|
216
|
-
throw new Error("Error on LlmSchemaProgrammer.write(): LLM schema does not allow recursive alias type.");
|
|
217
|
-
else
|
|
218
|
-
insert((0, exports.llm_schema_station)(__assign(__assign({}, props), { metadata: alias.type.value })));
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
222
|
-
finally {
|
|
223
|
-
try {
|
|
224
|
-
if (_z && !_z.done && (_g = _y.return)) _g.call(_y);
|
|
225
|
-
}
|
|
226
|
-
finally { if (e_7) throw e_7.error; }
|
|
227
|
-
}
|
|
228
|
-
//----
|
|
229
|
-
// RETURNS
|
|
230
|
-
//----
|
|
231
|
-
if (union.length === 0 && props.blockNever === true)
|
|
232
|
-
return null;
|
|
233
|
-
var schema = union.length === 0
|
|
234
|
-
? { type: undefined }
|
|
235
|
-
: union.length === 1
|
|
236
|
-
? union[0]
|
|
237
|
-
: { oneOf: union };
|
|
238
|
-
return __assign(__assign(__assign({}, schema), props.attribute), { title: (_h = props.attribute.title) !== null && _h !== void 0 ? _h : schema.title, description: (_j = props.attribute.description) !== null && _j !== void 0 ? _j : schema.description, deprecated: (_k = props.attribute.deprecated) !== null && _k !== void 0 ? _k : schema.deprecated });
|
|
239
|
-
};
|
|
240
|
-
exports.llm_schema_station = llm_schema_station;
|
|
241
|
-
//# sourceMappingURL=llm_schema_station.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm_schema_station.js","sourceRoot":"","sources":["../../../src/programmers/internal/llm_schema_station.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wEAAuE;AAEvE,gEAA+D;AAC/D,2DAA0D;AAC1D,6DAA4D;AAC5D,2DAA0D;AAC1D,2DAA0D;AAC1D,iEAAgE;AAChE,uEAAsE;AACtE,uDAAsD;AACtD,2DAA0D;AAC1D,yDAAwD;AACxD,yDAAwD;AACxD,uDAAsD;AAEtD;;GAEG;AACI,IAAM,kBAAkB,GAAG,UAAC,KAIlC;;;IACC,kBAAkB;IAClB,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAK,IAAI;QAC7B,6BACK,KAAK,CAAC,SAAS,KAClB,IAAI,EAAE,SAAS,IACf;SACC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK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AC,EAAE,IAAI,EAAE,SAAS,EAAE;QACrB,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAClB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE;YACX,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACzB,sCACK,MAAM,GACN,KAAK,CAAC,SAAS,KAClB,KAAK,EAAE,MAAA,KAAK,CAAC,SAAS,CAAC,KAAK,mCAAI,MAAM,CAAC,KAAK,EAC5C,WAAW,EAAE,MAAA,KAAK,CAAC,SAAS,CAAC,WAAW,mCAAI,MAAM,CAAC,WAAW,EAC9D,UAAU,EAAE,MAAA,KAAK,CAAC,SAAS,CAAC,UAAU,mCAAI,MAAM,CAAC,UAAU,IAC3D;AACJ,CAAC,CAAC;AAtKW,QAAA,kBAAkB,sBAsK7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.llm_schema_tuple = void 0;
|
|
15
|
-
var Metadata_1 = require("../../schemas/metadata/Metadata");
|
|
16
|
-
var llm_schema_station_1 = require("./llm_schema_station");
|
|
17
|
-
/**
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
var llm_schema_tuple = function (props) {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
return (__assign(__assign({}, props.attribute), { type: "array", items: (0, llm_schema_station_1.llm_schema_station)({
|
|
23
|
-
blockNever: false,
|
|
24
|
-
attribute: props.attribute,
|
|
25
|
-
metadata: props.tuple.type.elements.reduce(function (x, y) { var _a, _b; return Metadata_1.Metadata.merge((_a = x.rest) !== null && _a !== void 0 ? _a : x, (_b = y.rest) !== null && _b !== void 0 ? _b : y); }, Metadata_1.Metadata.initialize()),
|
|
26
|
-
}), minItems: !!((_a = props.tuple.type.elements.at(-1)) === null || _a === void 0 ? void 0 : _a.rest)
|
|
27
|
-
? props.tuple.type.elements.length - 1
|
|
28
|
-
: props.tuple.type.elements.filter(function (x) { return !x.optional; }).length, maxItems: !!((_b = props.tuple.type.elements.at(-1)) === null || _b === void 0 ? void 0 : _b.rest)
|
|
29
|
-
? undefined
|
|
30
|
-
: props.tuple.type.elements.length }));
|
|
31
|
-
};
|
|
32
|
-
exports.llm_schema_tuple = llm_schema_tuple;
|
|
33
|
-
//# sourceMappingURL=llm_schema_tuple.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm_schema_tuple.js","sourceRoot":"","sources":["../../../src/programmers/internal/llm_schema_tuple.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,4DAA2D;AAG3D,2DAA0D;AAE1D;;GAEG;AACI,IAAM,gBAAgB,GAAG,UAAC,KAGhC;;IAAwB,OAAA,uBACpB,KAAK,CAAC,SAAS,KAClB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,IAAA,uCAAkB,EAAC;YACxB,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CACxC,UAAC,CAAC,EAAE,CAAC,gBAAK,OAAA,mBAAQ,CAAC,KAAK,CAAC,MAAA,CAAC,CAAC,IAAI,mCAAI,CAAC,EAAE,MAAA,CAAC,CAAC,IAAI,mCAAI,CAAC,CAAC,CAAA,EAAA,EAClD,mBAAQ,CAAC,UAAU,EAAE,CACtB;SACF,CAAC,EACF,QAAQ,EAAE,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,0CAAE,IAAI,CAAA;YAChD,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YACtC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,QAAQ,EAAX,CAAW,CAAC,CAAC,MAAM,EAC/D,QAAQ,EAAE,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,0CAAE,IAAI,CAAA;YAChD,CAAC,CAAC,SAAU;YACZ,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,IACpC,CAAA;CAAA,CAAC;AApBU,QAAA,gBAAgB,oBAoB1B"}
|
|
@@ -1,56 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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((native) => native.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.type.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,25 +0,0 @@
|
|
|
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_number = <Version extends "3.0" | "3.1">(
|
|
11
|
-
atomic: MetadataAtomic,
|
|
12
|
-
): Schema<Version>[] =>
|
|
13
|
-
application_plugin({
|
|
14
|
-
schema: {
|
|
15
|
-
type: "number",
|
|
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 | OpenApiV3.IJsonSchema.INumber
|
|
25
|
-
: OpenApi.IJsonSchema.IInteger | OpenApi.IJsonSchema.INumber;
|
|
@@ -1,25 +0,0 @@
|
|
|
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_string = <Version extends "3.0" | "3.1">(
|
|
11
|
-
atomic: MetadataAtomic,
|
|
12
|
-
): Schema<Version>[] =>
|
|
13
|
-
application_plugin({
|
|
14
|
-
schema: {
|
|
15
|
-
type: "string",
|
|
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.IString
|
|
25
|
-
: OpenApi.IJsonSchema.IString;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { OpenApiV3 } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { CommentFactory } from "../../factories/CommentFactory";
|
|
4
|
-
|
|
5
|
-
import { IJsDocTagInfo } from "../../schemas/metadata/IJsDocTagInfo";
|
|
6
|
-
import { MetadataAlias } from "../../schemas/metadata/MetadataAlias";
|
|
7
|
-
|
|
8
|
-
import { application_description } from "./application_description";
|
|
9
|
-
import { application_plugin } from "./application_plugin";
|
|
10
|
-
import { application_v30_object } from "./application_v30_object";
|
|
11
|
-
import { application_v30_schema } from "./application_v30_schema";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export const application_v30_alias = <BlockNever extends boolean>(props: {
|
|
17
|
-
blockNever: BlockNever;
|
|
18
|
-
components: OpenApiV3.IComponents;
|
|
19
|
-
alias: MetadataAlias;
|
|
20
|
-
nullable: boolean;
|
|
21
|
-
}): OpenApiV3.IJsonSchema.IReference[] => {
|
|
22
|
-
if (
|
|
23
|
-
props.alias.type.value.size() === 1 &&
|
|
24
|
-
props.alias.type.value.objects.length === 1
|
|
25
|
-
)
|
|
26
|
-
return application_v30_object({
|
|
27
|
-
object: props.alias.type.value.objects[0]!,
|
|
28
|
-
components: props.components,
|
|
29
|
-
nullable: props.nullable,
|
|
30
|
-
}) as OpenApiV3.IJsonSchema.IReference[];
|
|
31
|
-
|
|
32
|
-
const key: string = `${props.alias.type.name}${props.nullable ? ".Nullable" : ""}`;
|
|
33
|
-
const $ref: string = `#/components/schemas/${key}`;
|
|
34
|
-
|
|
35
|
-
if (props.components.schemas?.[key] === undefined) {
|
|
36
|
-
// TEMPORARY ASSIGNMENT
|
|
37
|
-
props.components.schemas ??= {};
|
|
38
|
-
props.components.schemas[key] = {};
|
|
39
|
-
|
|
40
|
-
// GENERATE SCHEMA
|
|
41
|
-
const schema: OpenApiV3.IJsonSchema | null = application_v30_schema({
|
|
42
|
-
blockNever: props.blockNever,
|
|
43
|
-
components: props.components,
|
|
44
|
-
attribute: {
|
|
45
|
-
deprecated:
|
|
46
|
-
props.alias.type.jsDocTags.some((tag) => tag.name === "deprecated") ||
|
|
47
|
-
undefined,
|
|
48
|
-
title: (() => {
|
|
49
|
-
const info: IJsDocTagInfo | undefined =
|
|
50
|
-
props.alias.type.jsDocTags.find((tag) => tag.name === "title");
|
|
51
|
-
return info?.text?.length
|
|
52
|
-
? CommentFactory.merge(info.text)
|
|
53
|
-
: undefined;
|
|
54
|
-
})(),
|
|
55
|
-
description: application_description(props.alias.type),
|
|
56
|
-
},
|
|
57
|
-
metadata: props.alias.type.value,
|
|
58
|
-
});
|
|
59
|
-
if (schema !== null) Object.assign(props.components.schemas[key]!, schema);
|
|
60
|
-
}
|
|
61
|
-
return application_plugin({
|
|
62
|
-
schema: { $ref },
|
|
63
|
-
tags: props.alias.tags,
|
|
64
|
-
});
|
|
65
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { OpenApiV3 } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { MetadataConstant } from "../../schemas/metadata/MetadataConstant";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export const application_v30_constant = (
|
|
9
|
-
constant: MetadataConstant,
|
|
10
|
-
):
|
|
11
|
-
| OpenApiV3.IJsonSchema.IBoolean
|
|
12
|
-
| OpenApiV3.IJsonSchema.IInteger
|
|
13
|
-
| OpenApiV3.IJsonSchema.INumber
|
|
14
|
-
| OpenApiV3.IJsonSchema.IString => ({
|
|
15
|
-
type: constant.type as "string" | "number" | "boolean" | "integer",
|
|
16
|
-
enum: constant.values.map((v) => v.value) as any,
|
|
17
|
-
// @todo default
|
|
18
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { OpenApiV3 } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { MetadataNative } from "../../schemas/metadata/MetadataNative";
|
|
4
|
-
|
|
5
|
-
import { application_plugin } from "./application_plugin";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export const application_v30_native = (props: {
|
|
11
|
-
components: OpenApiV3.IComponents;
|
|
12
|
-
native: MetadataNative;
|
|
13
|
-
nullable: boolean;
|
|
14
|
-
}): OpenApiV3.IJsonSchema[] => {
|
|
15
|
-
if (props.native.name === "Blob" || props.native.name === "File")
|
|
16
|
-
return application_plugin({
|
|
17
|
-
schema: {
|
|
18
|
-
type: "string",
|
|
19
|
-
format: "binary",
|
|
20
|
-
nullable: props.nullable,
|
|
21
|
-
},
|
|
22
|
-
tags: props.native.tags,
|
|
23
|
-
});
|
|
24
|
-
const key: string = `${props.native.name}${props.nullable ? ".Nullable" : ""}`;
|
|
25
|
-
if (props.components.schemas?.[key] === undefined) {
|
|
26
|
-
props.components.schemas ??= {};
|
|
27
|
-
props.components.schemas[key] ??= {
|
|
28
|
-
type: "object",
|
|
29
|
-
properties: {},
|
|
30
|
-
nullable: props.nullable,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
return application_plugin({
|
|
34
|
-
schema: {
|
|
35
|
-
$ref: `#/components/schemas/${key}`,
|
|
36
|
-
},
|
|
37
|
-
tags: props.native.tags,
|
|
38
|
-
});
|
|
39
|
-
};
|