swagger-typescript-api 13.2.12 → 13.2.13
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/CHANGELOG.md +21 -4
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +1 -1
- package/dist/{src-LjX9fiRq.js → src-D-sCHrs2.js} +14 -11
- package/dist/src-D-sCHrs2.js.map +1 -0
- package/dist/{src-Fy1zzbnV.cjs → src-DsqbrbKP.cjs} +15 -12
- package/dist/src-DsqbrbKP.cjs.map +1 -0
- package/package.json +3 -4
- package/dist/src-Fy1zzbnV.cjs.map +0 -1
- package/dist/src-LjX9fiRq.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
# swagger-typescript-api
|
|
2
2
|
|
|
3
|
+
## 13.2.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1424](https://github.com/acacode/swagger-typescript-api/pull/1424) [`aa79764`](https://github.com/acacode/swagger-typescript-api/commit/aa79764bc27fc1787924c46a5905769dccbf385c) Thanks [@smorimoto](https://github.com/smorimoto)! - Ensure discriminator mappings use union enum literals.
|
|
8
|
+
|
|
9
|
+
Resolve discriminator mapping generation to use literal values when
|
|
10
|
+
`generateUnionEnums` is enabled to avoid emitting enum member references.
|
|
11
|
+
Add regression coverage that snapshots the discriminator output with
|
|
12
|
+
union enums.
|
|
13
|
+
|
|
14
|
+
- [#1422](https://github.com/acacode/swagger-typescript-api/pull/1422) [`724b0cd`](https://github.com/acacode/swagger-typescript-api/commit/724b0cd3d37acac1ac24fd547e2ad7af3a74bfd6) Thanks [@smorimoto](https://github.com/smorimoto)! - Replace `js-yaml` with `yaml`.
|
|
15
|
+
|
|
16
|
+
Switch YAML parsing from `js-yaml` to `yaml`. Update the resolver to
|
|
17
|
+
use `YAML.parse` when `JSON.parse` fails. Remove `js-yaml` and its types,
|
|
18
|
+
add `yaml` as a runtime dependency. No public API changes.
|
|
19
|
+
|
|
3
20
|
## 13.2.12
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
6
23
|
|
|
7
|
-
- [#1420](https://github.com/acacode/swagger-typescript-api/pull/1420) [`426433b`](https://github.com/acacode/swagger-typescript-api/commit/426433b3f6144b6f28f0b79614df28dd3dea2012) Thanks [@smorimoto](https://github.com/smorimoto)! - Move `@types/lodash` and `openapi-types` to dependencies
|
|
24
|
+
- [#1420](https://github.com/acacode/swagger-typescript-api/pull/1420) [`426433b`](https://github.com/acacode/swagger-typescript-api/commit/426433b3f6144b6f28f0b79614df28dd3dea2012) Thanks [@smorimoto](https://github.com/smorimoto)! - Move `@types/lodash` and `openapi-types` to dependencies.
|
|
8
25
|
|
|
9
26
|
These type packages are referenced by the published declarations, so consumers
|
|
10
27
|
require them at install time for correct type resolution. Moving them from
|
|
@@ -15,9 +32,9 @@
|
|
|
15
32
|
|
|
16
33
|
### Patch Changes
|
|
17
34
|
|
|
18
|
-
- [#1390](https://github.com/acacode/swagger-typescript-api/pull/1390) [`5897e4b`](https://github.com/acacode/swagger-typescript-api/commit/5897e4ba1e3d21adf9ccb161bfc6eb0f1dde966c) Thanks [@MatanAvneri](https://github.com/MatanAvneri)! - Fix being able to call getComponentByRef from templates
|
|
35
|
+
- [#1390](https://github.com/acacode/swagger-typescript-api/pull/1390) [`5897e4b`](https://github.com/acacode/swagger-typescript-api/commit/5897e4ba1e3d21adf9ccb161bfc6eb0f1dde966c) Thanks [@MatanAvneri](https://github.com/MatanAvneri)! - Fix being able to call getComponentByRef from templates.
|
|
19
36
|
|
|
20
|
-
- [#1393](https://github.com/acacode/swagger-typescript-api/pull/1393) [`9a7c788`](https://github.com/acacode/swagger-typescript-api/commit/9a7c788edc8efefbb8412bcc331e909b80ece317) Thanks [@RoCat](https://github.com/RoCat)! - Ensure discriminators are just after enums in components list to avoid cyclic errors
|
|
37
|
+
- [#1393](https://github.com/acacode/swagger-typescript-api/pull/1393) [`9a7c788`](https://github.com/acacode/swagger-typescript-api/commit/9a7c788edc8efefbb8412bcc331e909b80ece317) Thanks [@RoCat](https://github.com/RoCat)! - Ensure discriminators are just after enums in components list to avoid cyclic errors.
|
|
21
38
|
|
|
22
39
|
- [#1416](https://github.com/acacode/swagger-typescript-api/pull/1416) [`cd127a9`](https://github.com/acacode/swagger-typescript-api/commit/cd127a94e3386ef5eece740ba9335715fb7d13e0) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix fetch client response parsing without re-reading body.
|
|
23
40
|
|
|
@@ -25,7 +42,7 @@
|
|
|
25
42
|
|
|
26
43
|
### Patch Changes
|
|
27
44
|
|
|
28
|
-
- [`7b7351f`](https://github.com/acacode/swagger-typescript-api/commit/7b7351f90b250f7702cb57976c5c293ede353312) Thanks [@js2me](https://github.com/js2me)! -
|
|
45
|
+
- [`7b7351f`](https://github.com/acacode/swagger-typescript-api/commit/7b7351f90b250f7702cb57976c5c293ede353312) Thanks [@js2me](https://github.com/js2me)! - Fix missing exported interfaces and types.
|
|
29
46
|
|
|
30
47
|
## 13.2.9
|
|
31
48
|
|
package/dist/cli.cjs
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, generateApi, generateTemplates, package_default } from "./src-
|
|
2
|
+
import { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, generateApi, generateTemplates, package_default } from "./src-D-sCHrs2.js";
|
|
3
3
|
import * as path$1 from "node:path";
|
|
4
4
|
import { loadConfig } from "c12";
|
|
5
5
|
import { defineCommand, runMain } from "citty";
|
package/dist/lib.cjs
CHANGED
package/dist/lib.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RequestContentKind, SCHEMA_TYPES, constants_exports, generateApi, generateTemplates } from "./src-
|
|
1
|
+
import { RequestContentKind, SCHEMA_TYPES, constants_exports, generateApi, generateTemplates } from "./src-D-sCHrs2.js";
|
|
2
2
|
|
|
3
3
|
export { RequestContentKind, SCHEMA_TYPES, constants_exports as constants, generateApi, generateTemplates };
|
|
@@ -7,8 +7,8 @@ import * as path$1 from "node:path";
|
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { Biome, Distribution } from "@biomejs/js-api";
|
|
9
9
|
import * as nanoid from "nanoid";
|
|
10
|
-
import * as yaml from "js-yaml";
|
|
11
10
|
import * as swagger2openapi from "swagger2openapi";
|
|
11
|
+
import * as YAML from "yaml";
|
|
12
12
|
import * as url$1 from "node:url";
|
|
13
13
|
import url from "node:url";
|
|
14
14
|
import { Eta } from "eta";
|
|
@@ -176,7 +176,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
|
|
|
176
176
|
//#endregion
|
|
177
177
|
//#region package.json
|
|
178
178
|
var name = "swagger-typescript-api";
|
|
179
|
-
var version = "13.2.
|
|
179
|
+
var version = "13.2.13";
|
|
180
180
|
var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
|
|
181
181
|
var homepage = "https://github.com/acacode/swagger-typescript-api";
|
|
182
182
|
var bugs = "https://github.com/acacode/swagger-typescript-api/issues";
|
|
@@ -224,13 +224,13 @@ var dependencies = {
|
|
|
224
224
|
"citty": "^0.1.6",
|
|
225
225
|
"consola": "^3.4.2",
|
|
226
226
|
"eta": "^4.0.1",
|
|
227
|
-
"js-yaml": "^4.1.0",
|
|
228
227
|
"lodash": "^4.17.21",
|
|
229
228
|
"nanoid": "^5.1.5",
|
|
230
229
|
"openapi-types": "^12.1.3",
|
|
231
230
|
"swagger-schema-official": "2.0.0-bab6bed",
|
|
232
231
|
"swagger2openapi": "^7.0.8",
|
|
233
|
-
"typescript": "~5.9.2"
|
|
232
|
+
"typescript": "~5.9.2",
|
|
233
|
+
"yaml": "^2.8.1"
|
|
234
234
|
};
|
|
235
235
|
var devDependencies = {
|
|
236
236
|
"@biomejs/biome": "2.2.4",
|
|
@@ -238,7 +238,6 @@ var devDependencies = {
|
|
|
238
238
|
"@changesets/cli": "2.29.7",
|
|
239
239
|
"@tsconfig/node20": "20.1.6",
|
|
240
240
|
"@tsconfig/strictest": "2.0.5",
|
|
241
|
-
"@types/js-yaml": "4.0.9",
|
|
242
241
|
"@types/node": "24.5.2",
|
|
243
242
|
"@types/swagger2openapi": "7.0.4",
|
|
244
243
|
"axios": "1.12.2",
|
|
@@ -1036,9 +1035,13 @@ var DiscriminatorSchemaParser = class extends MonoSchemaParser {
|
|
|
1036
1035
|
let mappingPropertySchemaEnumKeysMap = {};
|
|
1037
1036
|
let mappingPropertySchema = lodash.get(abstractSchemaStruct?.component?.rawTypeData, ["properties", discPropertyName]);
|
|
1038
1037
|
if (this.schemaUtils.isRefSchema(mappingPropertySchema)) mappingPropertySchema = this.schemaUtils.getSchemaRefType(mappingPropertySchema);
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1038
|
+
const parsedEnum = mappingPropertySchema?.rawTypeData?.$parsed;
|
|
1039
|
+
if (parsedEnum?.type === SCHEMA_TYPES$1.ENUM) mappingPropertySchemaEnumKeysMap = lodash.reduce(parsedEnum.enum, (acc, key, index) => {
|
|
1040
|
+
const enumContent = parsedEnum.content?.[index];
|
|
1041
|
+
if (this.config.generateUnionEnums) {
|
|
1042
|
+
const literalValue = enumContent?.value ?? (key !== void 0 ? ts.StringValue(key) : void 0);
|
|
1043
|
+
if (literalValue !== void 0) acc[key] = literalValue;
|
|
1044
|
+
} else if (parsedEnum.typeName && enumContent?.key) acc[key] = ts.EnumUsageKey(parsedEnum.typeName, enumContent.key);
|
|
1042
1045
|
return acc;
|
|
1043
1046
|
}, {});
|
|
1044
1047
|
return mappingPropertySchemaEnumKeysMap;
|
|
@@ -2426,8 +2429,8 @@ var SwaggerSchemaResolver = class {
|
|
|
2426
2429
|
if (typeof file !== "string") return file;
|
|
2427
2430
|
try {
|
|
2428
2431
|
return JSON.parse(file);
|
|
2429
|
-
} catch
|
|
2430
|
-
return
|
|
2432
|
+
} catch {
|
|
2433
|
+
return YAML.parse(file);
|
|
2431
2434
|
}
|
|
2432
2435
|
}
|
|
2433
2436
|
fixSwaggerSchema({ usageSchema, originalSchema }) {
|
|
@@ -3148,4 +3151,4 @@ async function generateApi(config) {
|
|
|
3148
3151
|
|
|
3149
3152
|
//#endregion
|
|
3150
3153
|
export { CodeGenConfig, HTTP_CLIENT, RequestContentKind, SCHEMA_TYPES, TemplatesGenConfig, constants_exports, generateApi, generateTemplates, package_default };
|
|
3151
|
-
//# sourceMappingURL=src-
|
|
3154
|
+
//# sourceMappingURL=src-D-sCHrs2.js.map
|