swagger-typescript-api 13.2.11 → 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 +31 -3
- package/README.md +2 -2
- 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-BRCAbt5v.js → src-D-sCHrs2.js} +17 -14
- package/dist/src-D-sCHrs2.js.map +1 -0
- package/dist/{src-D2FYrO2h.cjs → src-DsqbrbKP.cjs} +18 -15
- package/dist/src-DsqbrbKP.cjs.map +1 -0
- package/package.json +6 -7
- package/dist/src-BRCAbt5v.js.map +0 -1
- package/dist/src-D2FYrO2h.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
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
|
+
|
|
20
|
+
## 13.2.12
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
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.
|
|
25
|
+
|
|
26
|
+
These type packages are referenced by the published declarations, so consumers
|
|
27
|
+
require them at install time for correct type resolution. Moving them from
|
|
28
|
+
`devDependencies` prevents downstream TypeScript errors whilst having no
|
|
29
|
+
runtime impact.
|
|
30
|
+
|
|
3
31
|
## 13.2.11
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
6
34
|
|
|
7
|
-
- [#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.
|
|
8
36
|
|
|
9
|
-
- [#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.
|
|
10
38
|
|
|
11
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.
|
|
12
40
|
|
|
@@ -14,7 +42,7 @@
|
|
|
14
42
|
|
|
15
43
|
### Patch Changes
|
|
16
44
|
|
|
17
|
-
- [`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.
|
|
18
46
|
|
|
19
47
|
## 13.2.9
|
|
20
48
|
|
package/README.md
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
- Support for OpenAPI 3.0, 2.0, JSON and YAML
|
|
4
4
|
- Generate the API Client for Fetch or Axios from an OpenAPI Specification
|
|
5
5
|
|
|
6
|
-
Any questions you can ask
|
|
6
|
+
Any questions you can ask here: <https://github.com/acacode/swagger-typescript-api/discussions>
|
|
7
7
|
|
|
8
8
|
## Examples
|
|
9
9
|
|
|
10
|
-
All examples you can find
|
|
10
|
+
All examples you can find here: <https://github.com/acacode/swagger-typescript-api/tree/main/tests>
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
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";
|
|
@@ -218,17 +218,19 @@ var scripts = {
|
|
|
218
218
|
var dependencies = {
|
|
219
219
|
"@biomejs/js-api": "3.0.0",
|
|
220
220
|
"@biomejs/wasm-nodejs": "2.2.4",
|
|
221
|
+
"@types/lodash": "^4.17.20",
|
|
221
222
|
"@types/swagger-schema-official": "^2.0.25",
|
|
222
223
|
"c12": "^3.3.0",
|
|
223
224
|
"citty": "^0.1.6",
|
|
224
225
|
"consola": "^3.4.2",
|
|
225
226
|
"eta": "^4.0.1",
|
|
226
|
-
"js-yaml": "^4.1.0",
|
|
227
227
|
"lodash": "^4.17.21",
|
|
228
228
|
"nanoid": "^5.1.5",
|
|
229
|
+
"openapi-types": "^12.1.3",
|
|
229
230
|
"swagger-schema-official": "2.0.0-bab6bed",
|
|
230
231
|
"swagger2openapi": "^7.0.8",
|
|
231
|
-
"typescript": "~5.9.2"
|
|
232
|
+
"typescript": "~5.9.2",
|
|
233
|
+
"yaml": "^2.8.1"
|
|
232
234
|
};
|
|
233
235
|
var devDependencies = {
|
|
234
236
|
"@biomejs/biome": "2.2.4",
|
|
@@ -236,17 +238,14 @@ var devDependencies = {
|
|
|
236
238
|
"@changesets/cli": "2.29.7",
|
|
237
239
|
"@tsconfig/node20": "20.1.6",
|
|
238
240
|
"@tsconfig/strictest": "2.0.5",
|
|
239
|
-
"@types/js-yaml": "4.0.9",
|
|
240
|
-
"@types/lodash": "4.17.20",
|
|
241
241
|
"@types/node": "24.5.2",
|
|
242
242
|
"@types/swagger2openapi": "7.0.4",
|
|
243
243
|
"axios": "1.12.2",
|
|
244
|
-
"openapi-types": "12.1.3",
|
|
245
244
|
"tsdown": "0.15.2",
|
|
246
245
|
"typedoc": "0.28.13",
|
|
247
246
|
"vitest": "3.2.4"
|
|
248
247
|
};
|
|
249
|
-
var packageManager = "yarn@4.
|
|
248
|
+
var packageManager = "yarn@4.10.2";
|
|
250
249
|
var engines = { "node": ">=20" };
|
|
251
250
|
var publishConfig = {
|
|
252
251
|
"access": "public",
|
|
@@ -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
|