swagger-typescript-api 13.12.2 → 13.12.4
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/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-DjdcR92W.mjs → src-BZg10unC.mjs} +20 -8
- package/dist/src-BZg10unC.mjs.map +1 -0
- package/dist/{src-VxYc58-l.cjs → src-C55JbE2j.cjs} +19 -7
- package/dist/src-C55JbE2j.cjs.map +1 -0
- package/package.json +12 -12
- package/dist/src-DjdcR92W.mjs.map +0 -1
- package/dist/src-VxYc58-l.cjs.map +0 -1
- /package/dist/{chunk-D7D4PA-g.mjs → rolldown-runtime-D7D4PA-g.mjs} +0 -0
|
@@ -212,7 +212,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
|
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region package.json
|
|
214
214
|
var name = "swagger-typescript-api";
|
|
215
|
-
var version = "13.12.
|
|
215
|
+
var version = "13.12.4";
|
|
216
216
|
var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/constants.ts
|
|
@@ -1083,6 +1083,7 @@ var ArraySchemaParser = class extends MonoSchemaParser {
|
|
|
1083
1083
|
var ComplexSchemaParser = class extends MonoSchemaParser {
|
|
1084
1084
|
parse() {
|
|
1085
1085
|
const complexType = this.schemaUtils.getComplexType(this.schema);
|
|
1086
|
+
const complexSchemaItems = Array.isArray(this.schema[complexType]) ? this.schema[complexType] : [];
|
|
1086
1087
|
const simpleSchema = (0, es_toolkit.omit)(this.schema, Object.keys(this.schemaParser._complexSchemaParsers));
|
|
1087
1088
|
const complexSchemaContent = this.schemaParser._complexSchemaParsers[complexType](this.schema);
|
|
1088
1089
|
return {
|
|
@@ -1093,7 +1094,7 @@ var ComplexSchemaParser = class extends MonoSchemaParser {
|
|
|
1093
1094
|
type: SCHEMA_TYPES$1.PRIMITIVE,
|
|
1094
1095
|
typeIdentifier: this.config.Ts.Keyword.Type,
|
|
1095
1096
|
name: this.typeName,
|
|
1096
|
-
description: this.schemaFormatters.formatDescription(this.schema.description || (0, es_toolkit.compact)(
|
|
1097
|
+
description: this.schemaFormatters.formatDescription(this.schema.description || (0, es_toolkit.compact)(complexSchemaItems.map((item) => item.description))[0] || ""),
|
|
1097
1098
|
content: this.config.Ts.IntersectionType((0, es_toolkit.compact)([this.config.Ts.ExpressionGroup(complexSchemaContent), this.schemaUtils.getInternalSchemaType(simpleSchema) === SCHEMA_TYPES$1.OBJECT && this.config.Ts.ExpressionGroup(this.schemaParserFabric.createSchemaParser({
|
|
1098
1099
|
schema: simpleSchema,
|
|
1099
1100
|
schemaPath: this.schemaPath
|
|
@@ -1415,11 +1416,13 @@ var ObjectSchemaParser = class extends MonoSchemaParser {
|
|
|
1415
1416
|
const readOnly = property.readOnly;
|
|
1416
1417
|
const complexType = this.schemaUtils.getComplexType(property);
|
|
1417
1418
|
const rawDataComplexType = this.schemaUtils.getComplexType(rawTypeData);
|
|
1419
|
+
const propertyComplexSchemaItems = Array.isArray(property[complexType]) ? property[complexType] : [];
|
|
1420
|
+
const rawDataComplexSchemaItems = Array.isArray(rawTypeData[rawDataComplexType]) ? rawTypeData[rawDataComplexType] : [];
|
|
1418
1421
|
propertiesContent.push({
|
|
1419
1422
|
...property,
|
|
1420
1423
|
$$raw: property,
|
|
1421
1424
|
title: property.title,
|
|
1422
|
-
description: property.description || (0, es_toolkit.compact)(
|
|
1425
|
+
description: property.description || (0, es_toolkit.compact)(propertyComplexSchemaItems.map((item) => item?.description))[0] || rawTypeData.description || (0, es_toolkit.compact)(rawDataComplexSchemaItems.map((item) => item?.description))[0] || "",
|
|
1423
1426
|
isRequired: required,
|
|
1424
1427
|
isNullable: nullable,
|
|
1425
1428
|
name: fieldName,
|
|
@@ -3325,14 +3328,23 @@ var Request = class {
|
|
|
3325
3328
|
}
|
|
3326
3329
|
async download({ url, authToken, ...options }) {
|
|
3327
3330
|
const requestOptions = {};
|
|
3328
|
-
if (authToken) requestOptions.headers = { Authorization: authToken };
|
|
3331
|
+
if (authToken && isSameHttpOrigin(url, this.config.url)) requestOptions.headers = { Authorization: authToken };
|
|
3329
3332
|
(0, es_toolkit.merge)((0, es_toolkit.merge)(requestOptions, options), this.config.requestOptions || {});
|
|
3333
|
+
const response = await fetchRemoteSchemaResponse(url, requestOptions, {
|
|
3334
|
+
specSourceUrl: this.config.url || void 0,
|
|
3335
|
+
allowExplicitSpecUrl: true
|
|
3336
|
+
});
|
|
3337
|
+
if (!response) {
|
|
3338
|
+
const message = `URL "${url}" is not allowed for fetching`;
|
|
3339
|
+
consola.consola.error(message);
|
|
3340
|
+
throw new Error(message);
|
|
3341
|
+
}
|
|
3330
3342
|
try {
|
|
3331
|
-
return await
|
|
3343
|
+
return await response.text();
|
|
3332
3344
|
} catch (error) {
|
|
3333
3345
|
const message = `error while fetching data from URL "${url}"`;
|
|
3334
3346
|
consola.consola.error(message, error);
|
|
3335
|
-
|
|
3347
|
+
throw new Error(message);
|
|
3336
3348
|
}
|
|
3337
3349
|
}
|
|
3338
3350
|
};
|
|
@@ -4323,4 +4335,4 @@ Object.defineProperty(exports, "version", {
|
|
|
4323
4335
|
}
|
|
4324
4336
|
});
|
|
4325
4337
|
|
|
4326
|
-
//# sourceMappingURL=src-
|
|
4338
|
+
//# sourceMappingURL=src-C55JbE2j.cjs.map
|