swagger-typescript-api 13.11.1 → 13.12.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/cli.cjs +2 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +6 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-CdwLmxYh.mjs → src-DNm4rxFm.mjs} +12 -4
- package/dist/src-DNm4rxFm.mjs.map +1 -0
- package/dist/{src-dL4yFLYT.cjs → src-t0Ockaa6.cjs} +12 -4
- package/dist/src-t0Ockaa6.cjs.map +1 -0
- package/package.json +1 -1
- package/templates/base/data-contracts.ejs +3 -0
- package/templates/base/enum-data-contract.ejs +10 -0
- package/templates/base/http-clients/axios-http-client.ejs +8 -0
- package/templates/base/http-clients/fetch-http-client.ejs +8 -0
- package/dist/src-CdwLmxYh.mjs.map +0 -1
- package/dist/src-dL4yFLYT.cjs.map +0 -1
|
@@ -208,7 +208,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
|
|
|
208
208
|
//#endregion
|
|
209
209
|
//#region package.json
|
|
210
210
|
var name = "swagger-typescript-api";
|
|
211
|
-
var version = "13.
|
|
211
|
+
var version = "13.12.0";
|
|
212
212
|
var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
|
|
213
213
|
//#endregion
|
|
214
214
|
//#region src/constants.ts
|
|
@@ -322,7 +322,7 @@ var CodeGenConfig = class {
|
|
|
322
322
|
generateRouteTypes = false;
|
|
323
323
|
/** CLI flag */
|
|
324
324
|
generateClient = true;
|
|
325
|
-
/** CLI flag. Controls enum output format: "enum" (default), "union" (T1 | T2 | TN),
|
|
325
|
+
/** CLI flag. Controls enum output format: "enum" (default), "union" (T1 | T2 | TN), "const" (as const object + type alias), or "const-enum" (const enum). */
|
|
326
326
|
enumStyle = "enum";
|
|
327
327
|
/** @deprecated Use enumStyle: "union" instead */
|
|
328
328
|
generateUnionEnums = false;
|
|
@@ -1357,7 +1357,7 @@ var EnumSchemaParser = class extends MonoSchemaParser {
|
|
|
1357
1357
|
schemaType: SCHEMA_TYPES$1.ENUM,
|
|
1358
1358
|
type: SCHEMA_TYPES$1.ENUM,
|
|
1359
1359
|
keyType,
|
|
1360
|
-
typeIdentifier: this.config.enumStyle === "const" ? this.config.Ts.Keyword.Const : this.config.enumStyle === "union" ? this.config.Ts.Keyword.Type : this.config.Ts.Keyword.Enum,
|
|
1360
|
+
typeIdentifier: this.config.enumStyle === "const" ? this.config.Ts.Keyword.Const : this.config.enumStyle === "const-enum" ? `${this.config.Ts.Keyword.Const} ${this.config.Ts.Keyword.Enum}` : this.config.enumStyle === "union" ? this.config.Ts.Keyword.Type : this.config.Ts.Keyword.Enum,
|
|
1361
1361
|
name: this.typeName,
|
|
1362
1362
|
description: this.schemaFormatters.formatDescription(this.schema.description),
|
|
1363
1363
|
content
|
|
@@ -3697,6 +3697,14 @@ var CodeGenProcess = class {
|
|
|
3697
3697
|
return parsed;
|
|
3698
3698
|
});
|
|
3699
3699
|
this.schemaRoutes.attachSchema(resolvedSwaggerSchema, parsedSchemas);
|
|
3700
|
+
if (!this.config.preferExistingSchemaNamesForExternalRefs) {
|
|
3701
|
+
this.typeNameFormatter.precommit(this.schemaComponentsMap.getComponents().map((component) => component.typeName));
|
|
3702
|
+
for (const component of componentsToParse) {
|
|
3703
|
+
component.typeData = null;
|
|
3704
|
+
delete component.$prepared;
|
|
3705
|
+
component.typeData = this.schemaParserFabric.parseSchema(component.rawTypeData, component.typeName);
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3700
3708
|
const rawConfiguration = {
|
|
3701
3709
|
apiConfig: this.createApiConfig(resolvedSwaggerSchema.usageSchema),
|
|
3702
3710
|
config: this.config,
|
|
@@ -4162,4 +4170,4 @@ Object.defineProperty(exports, "version", {
|
|
|
4162
4170
|
}
|
|
4163
4171
|
});
|
|
4164
4172
|
|
|
4165
|
-
//# sourceMappingURL=src-
|
|
4173
|
+
//# sourceMappingURL=src-t0Ockaa6.cjs.map
|