@orval/core 7.8.0 → 7.10.0
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/dist/index.d.ts +120 -70
- package/dist/index.js +197 -85
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4682,7 +4682,7 @@ var require_lodash = __commonJS({
|
|
|
4682
4682
|
function isArrayLikeObject(value) {
|
|
4683
4683
|
return isObjectLike(value) && isArrayLike(value);
|
|
4684
4684
|
}
|
|
4685
|
-
function
|
|
4685
|
+
function isBoolean3(value) {
|
|
4686
4686
|
return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
|
|
4687
4687
|
}
|
|
4688
4688
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
@@ -5819,7 +5819,7 @@ var require_lodash = __commonJS({
|
|
|
5819
5819
|
lodash.isArrayBuffer = isArrayBuffer;
|
|
5820
5820
|
lodash.isArrayLike = isArrayLike;
|
|
5821
5821
|
lodash.isArrayLikeObject = isArrayLikeObject;
|
|
5822
|
-
lodash.isBoolean =
|
|
5822
|
+
lodash.isBoolean = isBoolean3;
|
|
5823
5823
|
lodash.isBuffer = isBuffer;
|
|
5824
5824
|
lodash.isDate = isDate;
|
|
5825
5825
|
lodash.isElement = isElement;
|
|
@@ -6594,6 +6594,7 @@ function createScanner(text, ignoreTrivia) {
|
|
|
6594
6594
|
return token = 14;
|
|
6595
6595
|
}
|
|
6596
6596
|
switch (code) {
|
|
6597
|
+
// tokens: []{}:,
|
|
6597
6598
|
case 123:
|
|
6598
6599
|
pos++;
|
|
6599
6600
|
return token = 1;
|
|
@@ -6612,10 +6613,12 @@ function createScanner(text, ignoreTrivia) {
|
|
|
6612
6613
|
case 44:
|
|
6613
6614
|
pos++;
|
|
6614
6615
|
return token = 5;
|
|
6616
|
+
// strings
|
|
6615
6617
|
case 34:
|
|
6616
6618
|
pos++;
|
|
6617
6619
|
value = scanString();
|
|
6618
6620
|
return token = 10;
|
|
6621
|
+
// comments
|
|
6619
6622
|
case 47:
|
|
6620
6623
|
var start = pos - 1;
|
|
6621
6624
|
if (text.charCodeAt(pos + 1) === 47) {
|
|
@@ -6659,12 +6662,16 @@ function createScanner(text, ignoreTrivia) {
|
|
|
6659
6662
|
value += String.fromCharCode(code);
|
|
6660
6663
|
pos++;
|
|
6661
6664
|
return token = 16;
|
|
6665
|
+
// numbers
|
|
6662
6666
|
case 45:
|
|
6663
6667
|
value += String.fromCharCode(code);
|
|
6664
6668
|
pos++;
|
|
6665
6669
|
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
6666
6670
|
return token = 16;
|
|
6667
6671
|
}
|
|
6672
|
+
// found a minus, followed by a number so
|
|
6673
|
+
// we fall through to proceed with scanning
|
|
6674
|
+
// numbers
|
|
6668
6675
|
case 48:
|
|
6669
6676
|
case 49:
|
|
6670
6677
|
case 50:
|
|
@@ -6677,6 +6684,7 @@ function createScanner(text, ignoreTrivia) {
|
|
|
6677
6684
|
case 57:
|
|
6678
6685
|
value += scanNumber();
|
|
6679
6686
|
return token = 11;
|
|
6687
|
+
// literals and unknown symbols
|
|
6680
6688
|
default:
|
|
6681
6689
|
while (pos < len && isUnknownContentCharacter(code)) {
|
|
6682
6690
|
pos++;
|
|
@@ -9475,14 +9483,14 @@ var require_bool = __commonJS({
|
|
|
9475
9483
|
function constructYamlBoolean(data) {
|
|
9476
9484
|
return data === "true" || data === "True" || data === "TRUE";
|
|
9477
9485
|
}
|
|
9478
|
-
function
|
|
9486
|
+
function isBoolean3(object) {
|
|
9479
9487
|
return "[object Boolean]" === Object.prototype.toString.call(object);
|
|
9480
9488
|
}
|
|
9481
9489
|
module2.exports = new type_1.Type("tag:yaml.org,2002:bool", {
|
|
9482
9490
|
kind: "scalar",
|
|
9483
9491
|
resolve: resolveYamlBoolean,
|
|
9484
9492
|
construct: constructYamlBoolean,
|
|
9485
|
-
predicate:
|
|
9493
|
+
predicate: isBoolean3,
|
|
9486
9494
|
represent: {
|
|
9487
9495
|
lowercase: function(object) {
|
|
9488
9496
|
return object ? "true" : "false";
|
|
@@ -24963,6 +24971,7 @@ var require_immer_cjs_development = __commonJS({
|
|
|
24963
24971
|
switch (type) {
|
|
24964
24972
|
case 2:
|
|
24965
24973
|
return base2.set(key, value);
|
|
24974
|
+
/* istanbul ignore next */
|
|
24966
24975
|
case 3:
|
|
24967
24976
|
die(16);
|
|
24968
24977
|
default:
|
|
@@ -27628,6 +27637,7 @@ var require_URI = __commonJS({
|
|
|
27628
27637
|
switch (getType(value)) {
|
|
27629
27638
|
case "Undefined":
|
|
27630
27639
|
return name in data;
|
|
27640
|
+
// data[name] !== undefined;
|
|
27631
27641
|
case "Boolean":
|
|
27632
27642
|
var _booly = Boolean(isArray(data[name]) ? data[name].length : data[name]);
|
|
27633
27643
|
return value === _booly;
|
|
@@ -27649,6 +27659,7 @@ var require_URI = __commonJS({
|
|
|
27649
27659
|
return arrayContains(data[name], value);
|
|
27650
27660
|
case "Number":
|
|
27651
27661
|
value = String(value);
|
|
27662
|
+
/* falls through */
|
|
27652
27663
|
case "String":
|
|
27653
27664
|
if (!isArray(data[name])) {
|
|
27654
27665
|
return data[name] === value;
|
|
@@ -27942,6 +27953,7 @@ var require_URI = __commonJS({
|
|
|
27942
27953
|
return relative;
|
|
27943
27954
|
case "absolute":
|
|
27944
27955
|
return !relative;
|
|
27956
|
+
// hostname identification
|
|
27945
27957
|
case "domain":
|
|
27946
27958
|
case "name":
|
|
27947
27959
|
return name;
|
|
@@ -31107,7 +31119,7 @@ var require_index_node_cjs = __commonJS({
|
|
|
31107
31119
|
* @returns {string}
|
|
31108
31120
|
*/
|
|
31109
31121
|
static get version() {
|
|
31110
|
-
return "1.
|
|
31122
|
+
return "1.4.0";
|
|
31111
31123
|
}
|
|
31112
31124
|
/**
|
|
31113
31125
|
* @returns {string}
|
|
@@ -31890,6 +31902,7 @@ var require_index_node_cjs = __commonJS({
|
|
|
31890
31902
|
// see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)
|
|
31891
31903
|
binary_ops: {
|
|
31892
31904
|
"||": 1,
|
|
31905
|
+
"??": 1,
|
|
31893
31906
|
"&&": 2,
|
|
31894
31907
|
"|": 3,
|
|
31895
31908
|
"^": 4,
|
|
@@ -31909,10 +31922,11 @@ var require_index_node_cjs = __commonJS({
|
|
|
31909
31922
|
"-": 9,
|
|
31910
31923
|
"*": 10,
|
|
31911
31924
|
"/": 10,
|
|
31912
|
-
"%": 10
|
|
31925
|
+
"%": 10,
|
|
31926
|
+
"**": 11
|
|
31913
31927
|
},
|
|
31914
31928
|
// sets specific binary_ops as right-associative
|
|
31915
|
-
right_associative: /* @__PURE__ */ new Set(),
|
|
31929
|
+
right_associative: /* @__PURE__ */ new Set(["**"]),
|
|
31916
31930
|
// Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)
|
|
31917
31931
|
additional_identifier_chars: /* @__PURE__ */ new Set(["$", "_"]),
|
|
31918
31932
|
// Literals
|
|
@@ -32028,7 +32042,7 @@ var require_index_node_cjs = __commonJS({
|
|
|
32028
32042
|
var MINUS_CODE = 45;
|
|
32029
32043
|
var plugin = {
|
|
32030
32044
|
name: "assignment",
|
|
32031
|
-
assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|="]),
|
|
32045
|
+
assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
|
|
32032
32046
|
updateOperators: [PLUS_CODE, MINUS_CODE],
|
|
32033
32047
|
assignmentPrecedence: 0.9,
|
|
32034
32048
|
init(jsep2) {
|
|
@@ -32090,6 +32104,7 @@ var require_index_node_cjs = __commonJS({
|
|
|
32090
32104
|
jsep.addUnaryOp("typeof");
|
|
32091
32105
|
jsep.addLiteral("null", null);
|
|
32092
32106
|
jsep.addLiteral("undefined", void 0);
|
|
32107
|
+
var BLOCKED_PROTO_PROPERTIES = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]);
|
|
32093
32108
|
var SafeEval = {
|
|
32094
32109
|
/**
|
|
32095
32110
|
* @param {jsep.Expression} ast
|
|
@@ -32168,7 +32183,7 @@ var require_index_node_cjs = __commonJS({
|
|
|
32168
32183
|
return SafeEval.evalAst(ast.alternate, subs);
|
|
32169
32184
|
},
|
|
32170
32185
|
evalIdentifier(ast, subs) {
|
|
32171
|
-
if (ast.name
|
|
32186
|
+
if (Object.hasOwn(subs, ast.name)) {
|
|
32172
32187
|
return subs[ast.name];
|
|
32173
32188
|
}
|
|
32174
32189
|
throw ReferenceError(`${ast.name} is not defined`);
|
|
@@ -32177,22 +32192,22 @@ var require_index_node_cjs = __commonJS({
|
|
|
32177
32192
|
return ast.value;
|
|
32178
32193
|
},
|
|
32179
32194
|
evalMemberExpression(ast, subs) {
|
|
32180
|
-
|
|
32181
|
-
|
|
32182
|
-
|
|
32183
|
-
|
|
32195
|
+
const prop = String(
|
|
32196
|
+
// NOTE: `String(value)` throws error when
|
|
32197
|
+
// value has overwritten the toString method to return non-string
|
|
32198
|
+
// i.e. `value = {toString: () => []}`
|
|
32199
|
+
ast.computed ? SafeEval.evalAst(ast.property) : ast.property.name
|
|
32200
|
+
// `object.property` property is Identifier
|
|
32201
|
+
);
|
|
32184
32202
|
const obj = SafeEval.evalAst(ast.object, subs);
|
|
32203
|
+
if (obj === void 0 || obj === null) {
|
|
32204
|
+
throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
|
|
32205
|
+
}
|
|
32206
|
+
if (!Object.hasOwn(obj, prop) && BLOCKED_PROTO_PROPERTIES.has(prop)) {
|
|
32207
|
+
throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
|
|
32208
|
+
}
|
|
32185
32209
|
const result = obj[prop];
|
|
32186
32210
|
if (typeof result === "function") {
|
|
32187
|
-
if (obj === Function && prop === "bind") {
|
|
32188
|
-
throw new Error("Function.prototype.bind is disabled");
|
|
32189
|
-
}
|
|
32190
|
-
if (obj === Function && (prop === "call" || prop === "apply")) {
|
|
32191
|
-
throw new Error("Function.prototype.call and Function.prototype.apply are disabled");
|
|
32192
|
-
}
|
|
32193
|
-
if (result === Function) {
|
|
32194
|
-
return result;
|
|
32195
|
-
}
|
|
32196
32211
|
return result.bind(obj);
|
|
32197
32212
|
}
|
|
32198
32213
|
return result;
|
|
@@ -32214,9 +32229,6 @@ var require_index_node_cjs = __commonJS({
|
|
|
32214
32229
|
evalCallExpression(ast, subs) {
|
|
32215
32230
|
const args = ast.arguments.map((arg) => SafeEval.evalAst(arg, subs));
|
|
32216
32231
|
const func = SafeEval.evalAst(ast.callee, subs);
|
|
32217
|
-
if (func === Function) {
|
|
32218
|
-
throw new Error("Function constructor is disabled");
|
|
32219
|
-
}
|
|
32220
32232
|
return func(...args);
|
|
32221
32233
|
},
|
|
32222
32234
|
evalAssignmentExpression(ast, subs) {
|
|
@@ -32224,9 +32236,6 @@ var require_index_node_cjs = __commonJS({
|
|
|
32224
32236
|
throw SyntaxError("Invalid left-hand side in assignment");
|
|
32225
32237
|
}
|
|
32226
32238
|
const id = ast.left.name;
|
|
32227
|
-
if (id === "__proto__") {
|
|
32228
|
-
throw new Error("Assignment to __proto__ is disabled");
|
|
32229
|
-
}
|
|
32230
32239
|
const value = SafeEval.evalAst(ast.right, subs);
|
|
32231
32240
|
subs[id] = value;
|
|
32232
32241
|
return subs[id];
|
|
@@ -32246,9 +32255,7 @@ var require_index_node_cjs = __commonJS({
|
|
|
32246
32255
|
* @returns {EvaluatedResult} Result of evaluated code
|
|
32247
32256
|
*/
|
|
32248
32257
|
runInNewContext(context) {
|
|
32249
|
-
const keyMap =
|
|
32250
|
-
...context
|
|
32251
|
-
};
|
|
32258
|
+
const keyMap = Object.assign(/* @__PURE__ */ Object.create(null), context);
|
|
32252
32259
|
return SafeEval.evalAst(this.ast, keyMap);
|
|
32253
32260
|
}
|
|
32254
32261
|
};
|
|
@@ -32551,6 +32558,7 @@ var require_index_node_cjs = __commonJS({
|
|
|
32551
32558
|
addType = true;
|
|
32552
32559
|
}
|
|
32553
32560
|
break;
|
|
32561
|
+
/* c8 ignore next 2 */
|
|
32554
32562
|
default:
|
|
32555
32563
|
throw new TypeError("Unknown value type " + valueType);
|
|
32556
32564
|
}
|
|
@@ -41727,6 +41735,7 @@ var require_minimatch = __commonJS({
|
|
|
41727
41735
|
continue;
|
|
41728
41736
|
}
|
|
41729
41737
|
switch (c2) {
|
|
41738
|
+
/* istanbul ignore next */
|
|
41730
41739
|
case "/": {
|
|
41731
41740
|
return false;
|
|
41732
41741
|
}
|
|
@@ -41734,6 +41743,8 @@ var require_minimatch = __commonJS({
|
|
|
41734
41743
|
clearStateChar();
|
|
41735
41744
|
escaping = true;
|
|
41736
41745
|
continue;
|
|
41746
|
+
// the various stateChar values
|
|
41747
|
+
// for the "extglob" stuff.
|
|
41737
41748
|
case "?":
|
|
41738
41749
|
case "*":
|
|
41739
41750
|
case "+":
|
|
@@ -41794,6 +41805,7 @@ var require_minimatch = __commonJS({
|
|
|
41794
41805
|
clearStateChar();
|
|
41795
41806
|
re2 += "|";
|
|
41796
41807
|
continue;
|
|
41808
|
+
// these are mostly the same in regexp and glob
|
|
41797
41809
|
case "[":
|
|
41798
41810
|
clearStateChar();
|
|
41799
41811
|
if (inClass) {
|
|
@@ -44307,7 +44319,7 @@ var require_get_intrinsic = __commonJS({
|
|
|
44307
44319
|
if (!allowMissing) {
|
|
44308
44320
|
throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
|
|
44309
44321
|
}
|
|
44310
|
-
return void
|
|
44322
|
+
return void undefined2;
|
|
44311
44323
|
}
|
|
44312
44324
|
if ($gOPD && i3 + 1 >= parts.length) {
|
|
44313
44325
|
var desc = $gOPD(value, part);
|
|
@@ -45732,7 +45744,7 @@ var require_object_inspect = __commonJS({
|
|
|
45732
45744
|
if (isBigInt(obj)) {
|
|
45733
45745
|
return markBoxed(inspect(bigIntValueOf.call(obj)));
|
|
45734
45746
|
}
|
|
45735
|
-
if (
|
|
45747
|
+
if (isBoolean3(obj)) {
|
|
45736
45748
|
return markBoxed(booleanValueOf.call(obj));
|
|
45737
45749
|
}
|
|
45738
45750
|
if (isString3(obj)) {
|
|
@@ -45786,7 +45798,7 @@ var require_object_inspect = __commonJS({
|
|
|
45786
45798
|
function isNumber2(obj) {
|
|
45787
45799
|
return toStr(obj) === "[object Number]" && (!toStringTag2 || !(typeof obj === "object" && toStringTag2 in obj));
|
|
45788
45800
|
}
|
|
45789
|
-
function
|
|
45801
|
+
function isBoolean3(obj) {
|
|
45790
45802
|
return toStr(obj) === "[object Boolean]" && (!toStringTag2 || !(typeof obj === "object" && toStringTag2 in obj));
|
|
45791
45803
|
}
|
|
45792
45804
|
function isSymbol(obj) {
|
|
@@ -48114,9 +48126,11 @@ var require_dist10 = __commonJS({
|
|
|
48114
48126
|
});
|
|
48115
48127
|
|
|
48116
48128
|
// src/index.ts
|
|
48117
|
-
var
|
|
48118
|
-
__export(
|
|
48129
|
+
var index_exports = {};
|
|
48130
|
+
__export(index_exports, {
|
|
48119
48131
|
BODY_TYPE_NAME: () => BODY_TYPE_NAME,
|
|
48132
|
+
EnumGeneration: () => EnumGeneration,
|
|
48133
|
+
FormDataArrayHandling: () => FormDataArrayHandling,
|
|
48120
48134
|
GetterPropType: () => GetterPropType,
|
|
48121
48135
|
LogLevels: () => LogLevels,
|
|
48122
48136
|
NamingConvention: () => NamingConvention,
|
|
@@ -48170,6 +48184,7 @@ __export(src_exports, {
|
|
|
48170
48184
|
getArray: () => getArray,
|
|
48171
48185
|
getBody: () => getBody,
|
|
48172
48186
|
getEnum: () => getEnum,
|
|
48187
|
+
getEnumDescriptions: () => getEnumDescriptions,
|
|
48173
48188
|
getEnumImplementation: () => getEnumImplementation,
|
|
48174
48189
|
getEnumNames: () => getEnumNames,
|
|
48175
48190
|
getExtension: () => getExtension,
|
|
@@ -48215,6 +48230,7 @@ __export(src_exports, {
|
|
|
48215
48230
|
jsDoc: () => jsDoc,
|
|
48216
48231
|
jsStringEscape: () => jsStringEscape,
|
|
48217
48232
|
kebab: () => kebab,
|
|
48233
|
+
keyValuePairsToJsDoc: () => keyValuePairsToJsDoc,
|
|
48218
48234
|
loadFile: () => loadFile,
|
|
48219
48235
|
log: () => log,
|
|
48220
48236
|
logError: () => logError,
|
|
@@ -48245,7 +48261,7 @@ __export(src_exports, {
|
|
|
48245
48261
|
writeSplitTagsMode: () => writeSplitTagsMode,
|
|
48246
48262
|
writeTagsMode: () => writeTagsMode
|
|
48247
48263
|
});
|
|
48248
|
-
module.exports = __toCommonJS(
|
|
48264
|
+
module.exports = __toCommonJS(index_exports);
|
|
48249
48265
|
|
|
48250
48266
|
// src/types.ts
|
|
48251
48267
|
var PropertySortOrder = {
|
|
@@ -48258,6 +48274,11 @@ var NamingConvention = {
|
|
|
48258
48274
|
SNAKE_CASE: "snake_case",
|
|
48259
48275
|
KEBAB_CASE: "kebab-case"
|
|
48260
48276
|
};
|
|
48277
|
+
var EnumGeneration = {
|
|
48278
|
+
CONST: "const",
|
|
48279
|
+
ENUM: "enum",
|
|
48280
|
+
UNION: "union"
|
|
48281
|
+
};
|
|
48261
48282
|
var OutputClient = {
|
|
48262
48283
|
ANGULAR: "angular",
|
|
48263
48284
|
AXIOS: "axios",
|
|
@@ -48268,7 +48289,8 @@ var OutputClient = {
|
|
|
48268
48289
|
SWR: "swr",
|
|
48269
48290
|
ZOD: "zod",
|
|
48270
48291
|
HONO: "hono",
|
|
48271
|
-
FETCH: "fetch"
|
|
48292
|
+
FETCH: "fetch",
|
|
48293
|
+
MCP: "mcp"
|
|
48272
48294
|
};
|
|
48273
48295
|
var OutputHttpClient = {
|
|
48274
48296
|
AXIOS: "axios",
|
|
@@ -48283,6 +48305,11 @@ var OutputMode = {
|
|
|
48283
48305
|
var OutputMockType = {
|
|
48284
48306
|
MSW: "msw"
|
|
48285
48307
|
};
|
|
48308
|
+
var FormDataArrayHandling = {
|
|
48309
|
+
SERIALIZE: "serialize",
|
|
48310
|
+
EXPLODE: "explode",
|
|
48311
|
+
SERIALIZE_WITH_BRACKETS: "serialize-with-brackets"
|
|
48312
|
+
};
|
|
48286
48313
|
var Verbs = {
|
|
48287
48314
|
POST: "post",
|
|
48288
48315
|
PUT: "put",
|
|
@@ -49063,21 +49090,28 @@ var compareVersions = (firstVersion, secondVersions, operator = ">=") => {
|
|
|
49063
49090
|
var search = "\\*/";
|
|
49064
49091
|
var replacement = "*\\/";
|
|
49065
49092
|
var regex = new RegExp(search, "g");
|
|
49066
|
-
function jsDoc({
|
|
49067
|
-
|
|
49068
|
-
|
|
49069
|
-
|
|
49070
|
-
|
|
49071
|
-
|
|
49072
|
-
|
|
49073
|
-
|
|
49074
|
-
|
|
49075
|
-
|
|
49076
|
-
|
|
49077
|
-
|
|
49078
|
-
|
|
49079
|
-
|
|
49080
|
-
|
|
49093
|
+
function jsDoc(schema, tryOneLine = false, context) {
|
|
49094
|
+
if (context?.output?.override?.jsDoc) {
|
|
49095
|
+
const { filter: filter2 } = context.output.override.jsDoc;
|
|
49096
|
+
if (filter2) {
|
|
49097
|
+
return keyValuePairsToJsDoc(filter2(schema));
|
|
49098
|
+
}
|
|
49099
|
+
}
|
|
49100
|
+
const {
|
|
49101
|
+
description,
|
|
49102
|
+
deprecated,
|
|
49103
|
+
summary,
|
|
49104
|
+
minLength,
|
|
49105
|
+
maxLength,
|
|
49106
|
+
minimum,
|
|
49107
|
+
maximum,
|
|
49108
|
+
exclusiveMinimum,
|
|
49109
|
+
exclusiveMaximum,
|
|
49110
|
+
minItems,
|
|
49111
|
+
maxItems,
|
|
49112
|
+
nullable,
|
|
49113
|
+
pattern
|
|
49114
|
+
} = schema;
|
|
49081
49115
|
const lines = (Array.isArray(description) ? description.filter((d2) => !d2.includes("eslint-disable")) : [description || ""]).map((line) => line.replace(regex, replacement));
|
|
49082
49116
|
const count2 = [
|
|
49083
49117
|
description,
|
|
@@ -49149,6 +49183,16 @@ ${tryOneLine ? " " : ""} *`;
|
|
|
49149
49183
|
doc += "*/\n";
|
|
49150
49184
|
return doc;
|
|
49151
49185
|
}
|
|
49186
|
+
function keyValuePairsToJsDoc(keyValues) {
|
|
49187
|
+
if (!keyValues.length) return "";
|
|
49188
|
+
let doc = "/**\n";
|
|
49189
|
+
keyValues.forEach(({ key, value }) => {
|
|
49190
|
+
doc += ` * @${key} ${value}
|
|
49191
|
+
`;
|
|
49192
|
+
});
|
|
49193
|
+
doc += " */\n";
|
|
49194
|
+
return doc;
|
|
49195
|
+
}
|
|
49152
49196
|
|
|
49153
49197
|
// src/utils/dynamic-import.ts
|
|
49154
49198
|
var import_url = require("url");
|
|
@@ -49365,6 +49409,7 @@ var jsStringEscape = (input) => input.replace(/["'\\\n\r\u2028\u2029]/g, (charac
|
|
|
49365
49409
|
case "'":
|
|
49366
49410
|
case "\\":
|
|
49367
49411
|
return "\\" + character;
|
|
49412
|
+
// Four possible LineTerminator characters need to be escaped:
|
|
49368
49413
|
case "\n":
|
|
49369
49414
|
return "\\n";
|
|
49370
49415
|
case "\r":
|
|
@@ -49423,33 +49468,42 @@ var getIsBodyVerb = (verb) => VERBS_WITH_BODY.includes(verb);
|
|
|
49423
49468
|
var getEnumNames = (schemaObject) => {
|
|
49424
49469
|
return schemaObject?.["x-enumNames"] || schemaObject?.["x-enumnames"] || schemaObject?.["x-enum-varnames"];
|
|
49425
49470
|
};
|
|
49426
|
-
var
|
|
49427
|
-
|
|
49428
|
-
|
|
49471
|
+
var getEnumDescriptions = (schemaObject) => {
|
|
49472
|
+
return schemaObject?.["x-enumDescriptions"] || schemaObject?.["x-enumdescriptions"] || schemaObject?.["x-enum-descriptions"];
|
|
49473
|
+
};
|
|
49474
|
+
var getEnum = (value, enumName, names, enumGenerationType, descriptions) => {
|
|
49475
|
+
if (enumGenerationType === EnumGeneration.CONST)
|
|
49476
|
+
return getTypeConstEnum(value, enumName, names, descriptions);
|
|
49477
|
+
if (enumGenerationType === EnumGeneration.ENUM)
|
|
49478
|
+
return getNativeEnum(value, enumName, names);
|
|
49479
|
+
if (enumGenerationType === EnumGeneration.UNION)
|
|
49480
|
+
return getUnion(value, enumName);
|
|
49481
|
+
throw new Error(`Invalid enumGenerationType: ${enumGenerationType}`);
|
|
49429
49482
|
};
|
|
49430
|
-
var getTypeConstEnum = (value, enumName, names) => {
|
|
49483
|
+
var getTypeConstEnum = (value, enumName, names, descriptions) => {
|
|
49431
49484
|
let enumValue = `export type ${enumName} = typeof ${enumName}[keyof typeof ${enumName}]`;
|
|
49432
49485
|
if (value.endsWith(" | null")) {
|
|
49433
49486
|
value = value.replace(" | null", "");
|
|
49434
49487
|
enumValue += " | null";
|
|
49435
49488
|
}
|
|
49436
49489
|
enumValue += ";\n";
|
|
49437
|
-
const implementation = getEnumImplementation(value, names);
|
|
49438
|
-
enumValue +=
|
|
49439
|
-
|
|
49440
|
-
`;
|
|
49490
|
+
const implementation = getEnumImplementation(value, names, descriptions);
|
|
49491
|
+
enumValue += "\n\n";
|
|
49441
49492
|
enumValue += "// eslint-disable-next-line @typescript-eslint/no-redeclare\n";
|
|
49442
49493
|
enumValue += `export const ${enumName} = {
|
|
49443
49494
|
${implementation}} as const;
|
|
49444
49495
|
`;
|
|
49445
49496
|
return enumValue;
|
|
49446
49497
|
};
|
|
49447
|
-
var getEnumImplementation = (value, names) => {
|
|
49498
|
+
var getEnumImplementation = (value, names, descriptions) => {
|
|
49448
49499
|
if (value === "") return "";
|
|
49449
49500
|
return [...new Set(value.split(" | "))].reduce((acc, val, index3) => {
|
|
49450
49501
|
const name = names?.[index3];
|
|
49502
|
+
const description = descriptions?.[index3];
|
|
49503
|
+
const comment = description ? ` /** ${description} */
|
|
49504
|
+
` : "";
|
|
49451
49505
|
if (name) {
|
|
49452
|
-
return acc + ` ${import_esutils2.keyword.isIdentifierNameES5(name) ? name : `'${name}'`}: ${val},
|
|
49506
|
+
return acc + comment + ` ${import_esutils2.keyword.isIdentifierNameES5(name) ? name : `'${name}'`}: ${val},
|
|
49453
49507
|
`;
|
|
49454
49508
|
}
|
|
49455
49509
|
let key = val.startsWith("'") ? val.slice(1, -1) : val;
|
|
@@ -49465,7 +49519,7 @@ var getEnumImplementation = (value, names) => {
|
|
|
49465
49519
|
special: true
|
|
49466
49520
|
});
|
|
49467
49521
|
}
|
|
49468
|
-
return acc + ` ${import_esutils2.keyword.isIdentifierNameES5(key) ? key : `'${key}'`}: ${val},
|
|
49522
|
+
return acc + comment + ` ${import_esutils2.keyword.isIdentifierNameES5(key) ? key : `'${key}'`}: ${val},
|
|
49469
49523
|
`;
|
|
49470
49524
|
}, "");
|
|
49471
49525
|
};
|
|
@@ -49510,6 +49564,9 @@ var toNumberKey = (value) => {
|
|
|
49510
49564
|
}
|
|
49511
49565
|
return `NUMBER_${value}`;
|
|
49512
49566
|
};
|
|
49567
|
+
var getUnion = (value, enumName) => {
|
|
49568
|
+
return `export type ${enumName} = ${value};`;
|
|
49569
|
+
};
|
|
49513
49570
|
|
|
49514
49571
|
// src/getters/ref.ts
|
|
49515
49572
|
var RefComponentSuffix = {
|
|
@@ -49751,7 +49808,8 @@ var resolveObjectOriginal = ({
|
|
|
49751
49808
|
resolvedValue.value,
|
|
49752
49809
|
propName,
|
|
49753
49810
|
getEnumNames(resolvedValue.originalSchema),
|
|
49754
|
-
context.output.override.
|
|
49811
|
+
context.output.override.enumGenerationType,
|
|
49812
|
+
getEnumDescriptions(resolvedValue.originalSchema)
|
|
49755
49813
|
);
|
|
49756
49814
|
return {
|
|
49757
49815
|
value: propName,
|
|
@@ -50140,39 +50198,80 @@ var resolveSchemaPropertiesToFormData = ({
|
|
|
50140
50198
|
variableName,
|
|
50141
50199
|
propName,
|
|
50142
50200
|
context,
|
|
50143
|
-
isRequestBodyOptional
|
|
50201
|
+
isRequestBodyOptional,
|
|
50202
|
+
keyPrefix = "",
|
|
50203
|
+
depth = 0
|
|
50144
50204
|
}) => {
|
|
50145
50205
|
const formDataValues = Object.entries(schema.properties ?? {}).reduce(
|
|
50146
50206
|
(acc, [key, value]) => {
|
|
50147
50207
|
const { schema: property } = resolveRef(value, context);
|
|
50208
|
+
if (property.readOnly) {
|
|
50209
|
+
return acc;
|
|
50210
|
+
}
|
|
50148
50211
|
let formDataValue = "";
|
|
50149
50212
|
const formattedKeyPrefix = !isRequestBodyOptional ? "" : !import_esutils3.keyword.isIdentifierNameES5(key) ? "?." : "?";
|
|
50150
50213
|
const formattedKey = !import_esutils3.keyword.isIdentifierNameES5(key) ? `['${key}']` : `.${key}`;
|
|
50151
50214
|
const valueKey = `${propName}${formattedKeyPrefix}${formattedKey}`;
|
|
50152
50215
|
const nonOptionalValueKey = `${propName}${formattedKey}`;
|
|
50153
50216
|
if (property.type === "object") {
|
|
50154
|
-
|
|
50217
|
+
if (context.output.override.formData.arrayHandling === FormDataArrayHandling.EXPLODE) {
|
|
50218
|
+
formDataValue = resolveSchemaPropertiesToFormData({
|
|
50219
|
+
schema: property,
|
|
50220
|
+
variableName,
|
|
50221
|
+
propName: nonOptionalValueKey,
|
|
50222
|
+
context,
|
|
50223
|
+
isRequestBodyOptional,
|
|
50224
|
+
keyPrefix: `${keyPrefix}${key}.`,
|
|
50225
|
+
depth: depth + 1
|
|
50226
|
+
});
|
|
50227
|
+
} else {
|
|
50228
|
+
formDataValue = `${variableName}.append(\`${keyPrefix}${key}\`, JSON.stringify(${nonOptionalValueKey}));
|
|
50155
50229
|
`;
|
|
50230
|
+
}
|
|
50156
50231
|
} else if (property.type === "array") {
|
|
50157
50232
|
let valueStr = "value";
|
|
50233
|
+
let hasNonPrimitiveChild = false;
|
|
50158
50234
|
if (property.items) {
|
|
50159
50235
|
const { schema: itemSchema } = resolveRef(
|
|
50160
50236
|
property.items,
|
|
50161
50237
|
context
|
|
50162
50238
|
);
|
|
50163
50239
|
if (itemSchema.type === "object" || itemSchema.type === "array") {
|
|
50164
|
-
|
|
50240
|
+
if (context.output.override.formData.arrayHandling === FormDataArrayHandling.EXPLODE) {
|
|
50241
|
+
hasNonPrimitiveChild = true;
|
|
50242
|
+
const resolvedValue = resolveSchemaPropertiesToFormData({
|
|
50243
|
+
schema: itemSchema,
|
|
50244
|
+
variableName,
|
|
50245
|
+
propName: "value",
|
|
50246
|
+
context,
|
|
50247
|
+
isRequestBodyOptional,
|
|
50248
|
+
keyPrefix: `${keyPrefix}${key}[\${index${depth > 0 ? depth : ""}}].`,
|
|
50249
|
+
depth: depth + 1
|
|
50250
|
+
});
|
|
50251
|
+
formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ""}) => {
|
|
50252
|
+
${resolvedValue}});
|
|
50253
|
+
`;
|
|
50254
|
+
} else {
|
|
50255
|
+
valueStr = "JSON.stringify(value)";
|
|
50256
|
+
}
|
|
50165
50257
|
} else if (itemSchema.type === "number" || itemSchema.type?.includes("number") || itemSchema.type === "integer" || itemSchema.type?.includes("integer") || itemSchema.type === "boolean" || itemSchema.type?.includes("boolean")) {
|
|
50166
50258
|
valueStr = "value.toString()";
|
|
50167
50259
|
}
|
|
50168
50260
|
}
|
|
50169
|
-
|
|
50261
|
+
if (context.output.override.formData.arrayHandling === FormDataArrayHandling.EXPLODE) {
|
|
50262
|
+
if (!hasNonPrimitiveChild) {
|
|
50263
|
+
formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ""}) => ${variableName}.append(\`${keyPrefix}${key}[\${index${depth > 0 ? depth : ""}}]\`, ${valueStr}));
|
|
50264
|
+
`;
|
|
50265
|
+
}
|
|
50266
|
+
} else {
|
|
50267
|
+
formDataValue = `${valueKey}.forEach(value => ${variableName}.append(\`${keyPrefix}${key}${context.output.override.formData.arrayHandling === FormDataArrayHandling.SERIALIZE_WITH_BRACKETS ? "[]" : ""}\`, ${valueStr}));
|
|
50170
50268
|
`;
|
|
50269
|
+
}
|
|
50171
50270
|
} else if (property.type === "number" || property.type?.includes("number") || property.type === "integer" || property.type?.includes("integer") || property.type === "boolean" || property.type?.includes("boolean")) {
|
|
50172
|
-
formDataValue = `${variableName}.append(
|
|
50271
|
+
formDataValue = `${variableName}.append(\`${keyPrefix}${key}\`, ${nonOptionalValueKey}.toString())
|
|
50173
50272
|
`;
|
|
50174
50273
|
} else {
|
|
50175
|
-
formDataValue = `${variableName}.append(
|
|
50274
|
+
formDataValue = `${variableName}.append(\`${keyPrefix}${key}\`, ${nonOptionalValueKey})
|
|
50176
50275
|
`;
|
|
50177
50276
|
}
|
|
50178
50277
|
let existSubSchemaNullable = false;
|
|
@@ -50184,7 +50283,7 @@ var resolveSchemaPropertiesToFormData = ({
|
|
|
50184
50283
|
if (subSchemas?.some((subSchema) => {
|
|
50185
50284
|
return ["number", "integer", "boolean"].includes(subSchema.type);
|
|
50186
50285
|
})) {
|
|
50187
|
-
formDataValue = `${variableName}.append(
|
|
50286
|
+
formDataValue = `${variableName}.append(\`${key}\`, ${nonOptionalValueKey}.toString())
|
|
50188
50287
|
`;
|
|
50189
50288
|
}
|
|
50190
50289
|
if (subSchemas?.some((subSchema) => {
|
|
@@ -50369,7 +50468,7 @@ var getObject = ({
|
|
|
50369
50468
|
if (!index3) {
|
|
50370
50469
|
acc.value += "{";
|
|
50371
50470
|
}
|
|
50372
|
-
const doc = jsDoc(schema, true);
|
|
50471
|
+
const doc = jsDoc(schema, true, context);
|
|
50373
50472
|
acc.hasReadonlyProps ||= isReadOnly || false;
|
|
50374
50473
|
acc.imports.push(...resolvedValue.imports);
|
|
50375
50474
|
acc.value += `
|
|
@@ -50803,7 +50902,8 @@ var getCombineEnumValue = ({
|
|
|
50803
50902
|
return `...${e3},`;
|
|
50804
50903
|
}
|
|
50805
50904
|
const names = getEnumNames(originalSchema[i3]);
|
|
50806
|
-
|
|
50905
|
+
const descriptions = getEnumDescriptions(originalSchema[i3]);
|
|
50906
|
+
return getEnumImplementation(e3, names, descriptions);
|
|
50807
50907
|
}).join("");
|
|
50808
50908
|
return `{${enums}} as const`;
|
|
50809
50909
|
};
|
|
@@ -50990,10 +51090,10 @@ var getProps = ({
|
|
|
50990
51090
|
};
|
|
50991
51091
|
const queryParamsProp = {
|
|
50992
51092
|
name: "params",
|
|
50993
|
-
definition: `params${queryParams?.isOptional ? "?" : ""}: ${queryParams?.schema.name}`,
|
|
50994
|
-
implementation: `params${queryParams?.isOptional ? "?" : ""}: ${queryParams?.schema.name}`,
|
|
51093
|
+
definition: `params${queryParams?.isOptional || context.output.allParamsOptional ? "?" : ""}: ${queryParams?.schema.name}`,
|
|
51094
|
+
implementation: `params${queryParams?.isOptional || context.output.allParamsOptional ? "?" : ""}: ${queryParams?.schema.name}`,
|
|
50995
51095
|
default: false,
|
|
50996
|
-
required: !isUndefined(queryParams?.isOptional) ? !queryParams?.isOptional :
|
|
51096
|
+
required: !isUndefined(queryParams?.isOptional) ? !queryParams?.isOptional && !context.output.allParamsOptional : !context.output.allParamsOptional,
|
|
50997
51097
|
type: GetterPropType.QUERY_PARAM
|
|
50998
51098
|
};
|
|
50999
51099
|
const headersProp = {
|
|
@@ -51071,7 +51171,14 @@ var getQueryParamsTypes = (queryParams, operationName, context) => {
|
|
|
51071
51171
|
name: queryName
|
|
51072
51172
|
});
|
|
51073
51173
|
const key = getKey(name);
|
|
51074
|
-
const doc = jsDoc(
|
|
51174
|
+
const doc = jsDoc(
|
|
51175
|
+
{
|
|
51176
|
+
description: parameter.description,
|
|
51177
|
+
...schema
|
|
51178
|
+
},
|
|
51179
|
+
void 0,
|
|
51180
|
+
context
|
|
51181
|
+
);
|
|
51075
51182
|
if (parameterImports.length) {
|
|
51076
51183
|
return {
|
|
51077
51184
|
definition: `${doc}${key}${!required || schema.default ? "?" : ""}: ${parameterImports[0].name};`,
|
|
@@ -51086,7 +51193,8 @@ var getQueryParamsTypes = (queryParams, operationName, context) => {
|
|
|
51086
51193
|
resolvedValue.value,
|
|
51087
51194
|
enumName,
|
|
51088
51195
|
getEnumNames(resolvedValue.originalSchema),
|
|
51089
|
-
context.output.override.
|
|
51196
|
+
context.output.override.enumGenerationType,
|
|
51197
|
+
getEnumDescriptions(resolvedValue.originalSchema)
|
|
51090
51198
|
);
|
|
51091
51199
|
return {
|
|
51092
51200
|
definition: `${doc}${key}${!required || schema.default ? "?" : ""}: ${enumName};`,
|
|
@@ -52052,7 +52160,7 @@ var generateInterface = ({
|
|
|
52052
52160
|
}
|
|
52053
52161
|
if (scalar.type === "object" && !context?.output.override?.useTypeOverInterfaces) {
|
|
52054
52162
|
if (scalar.type === "object" && schema.properties && Object.values(schema.properties).length > 0 && Object.values(schema.properties).every((item) => "const" in item)) {
|
|
52055
|
-
const mappedScalarValue = scalar.value.replaceAll(";", ",");
|
|
52163
|
+
const mappedScalarValue = scalar.value.replaceAll(";", ",").replaceAll("?:", ":");
|
|
52056
52164
|
model += `export const ${name}Value = ${mappedScalarValue} as const;
|
|
52057
52165
|
export type ${name} = typeof ${name}Value;
|
|
52058
52166
|
`;
|
|
@@ -52127,7 +52235,8 @@ var generateSchemasDefinition = (schemas = {}, context, suffix, filters) => {
|
|
|
52127
52235
|
resolvedValue.value,
|
|
52128
52236
|
schemaName,
|
|
52129
52237
|
getEnumNames(resolvedValue.originalSchema),
|
|
52130
|
-
context.output.override.
|
|
52238
|
+
context.output.override.enumGenerationType,
|
|
52239
|
+
getEnumDescriptions(resolvedValue.originalSchema)
|
|
52131
52240
|
);
|
|
52132
52241
|
} else if (schemaName === resolvedValue.value && resolvedValue.isRef) {
|
|
52133
52242
|
const { schema: referredSchema } = resolveRef(schema, context);
|
|
@@ -52204,8 +52313,7 @@ var generateVerbOptions = async ({
|
|
|
52204
52313
|
overrideOperation
|
|
52205
52314
|
);
|
|
52206
52315
|
const overrideOperationName = overrideOperation?.operationName || output.override?.operationName;
|
|
52207
|
-
const
|
|
52208
|
-
const operationName = sanitize(overriddenOperationName, { es5keyword: true });
|
|
52316
|
+
const operationName = overrideOperationName ? overrideOperationName(operation, route, verb) : sanitize(camel(operationId), { es5keyword: true });
|
|
52209
52317
|
const response = getResponse({
|
|
52210
52318
|
responses,
|
|
52211
52319
|
operationName,
|
|
@@ -52255,10 +52363,10 @@ var generateVerbOptions = async ({
|
|
|
52255
52363
|
workspace: context.workspace,
|
|
52256
52364
|
tsconfig: context.output.tsconfig
|
|
52257
52365
|
});
|
|
52258
|
-
const formData =
|
|
52366
|
+
const formData = !override.formData.disabled && body.formData ? await generateMutator({
|
|
52259
52367
|
output: output.target,
|
|
52260
52368
|
name: operationName,
|
|
52261
|
-
mutator: override.formData,
|
|
52369
|
+
mutator: override.formData.mutator,
|
|
52262
52370
|
workspace: context.workspace,
|
|
52263
52371
|
tsconfig: context.output.tsconfig
|
|
52264
52372
|
}) : void 0;
|
|
@@ -53247,6 +53355,8 @@ var writeTagsMode = async ({
|
|
|
53247
53355
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53248
53356
|
0 && (module.exports = {
|
|
53249
53357
|
BODY_TYPE_NAME,
|
|
53358
|
+
EnumGeneration,
|
|
53359
|
+
FormDataArrayHandling,
|
|
53250
53360
|
GetterPropType,
|
|
53251
53361
|
LogLevels,
|
|
53252
53362
|
NamingConvention,
|
|
@@ -53300,6 +53410,7 @@ var writeTagsMode = async ({
|
|
|
53300
53410
|
getArray,
|
|
53301
53411
|
getBody,
|
|
53302
53412
|
getEnum,
|
|
53413
|
+
getEnumDescriptions,
|
|
53303
53414
|
getEnumImplementation,
|
|
53304
53415
|
getEnumNames,
|
|
53305
53416
|
getExtension,
|
|
@@ -53345,6 +53456,7 @@ var writeTagsMode = async ({
|
|
|
53345
53456
|
jsDoc,
|
|
53346
53457
|
jsStringEscape,
|
|
53347
53458
|
kebab,
|
|
53459
|
+
keyValuePairsToJsDoc,
|
|
53348
53460
|
loadFile,
|
|
53349
53461
|
log,
|
|
53350
53462
|
logError,
|