Skip to content

Commit 3d33625

Browse files
authored
Merge branch 'main' into fix/formdata-array-handling
2 parents abc99ef + 61225f5 commit 3d33625

File tree

17 files changed

+2745
-1072
lines changed

17 files changed

+2745
-1072
lines changed

.envrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
node-version: [24, 22, 20]
14+
node-version: [25, 24, 22, 20]
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout tree
18-
uses: actions/checkout@v5
19-
- name: Set-up Node.js
20-
uses: actions/setup-node@v5
18+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
19+
- name: Set-up Mise
20+
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3.5.1
2121
with:
22-
check-latest: true
23-
node-version: ${{ matrix.node-version }}
24-
package-manager-cache: false
25-
- run: corepack enable
22+
cache: false
23+
mise_toml: |
24+
[tools]
25+
node = "${{ matrix.node-version }}"
26+
yarn = "4"
2627
- run: yarn install --immutable
2728
- run: yarn format:check
2829
- run: yarn build

.github/workflows/typedoc.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,19 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout tree
27-
uses: actions/checkout@v5
28-
- name: Set-up Node.js
29-
uses: actions/setup-node@v5
27+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
28+
- name: Set-up Mise
29+
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3.5.1
3030
with:
31-
check-latest: true
32-
node-version-file: .nvmrc
33-
package-manager-cache: false
34-
- run: corepack enable
31+
cache: false
3532
- run: yarn install --immutable
3633
- run: yarn typedoc
3734
- name: Set-up Pages
38-
uses: actions/configure-pages@v5
35+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
3936
- name: Upload artifact
40-
uses: actions/upload-pages-artifact@v4
37+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
4138
with:
4239
path: docs
4340
- name: Deploy odoc to GitHub Pages
44-
uses: actions/deploy-pages@v4
41+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
4542
id: deployment

.github/workflows/version-or-publish.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout tree
23-
uses: actions/checkout@v5
24-
- name: Set-up Node.js
25-
uses: actions/setup-node@v5
23+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
24+
- name: Set-up Mise
25+
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3.5.1
2626
with:
27-
check-latest: true
28-
node-version-file: .nvmrc
29-
package-manager-cache: false
30-
- run: corepack enable
27+
cache: false
3128
- run: yarn install --immutable
3229
- name: Create Release Pull Request
33-
uses: changesets/action@v1
30+
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
3431
with:
3532
version: yarn changeset version
3633
publish: yarn npm publish --tolerate-republish

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
11
# swagger-typescript-api
22

3+
## 13.2.16
4+
5+
### Patch Changes
6+
7+
- [#1459](https://github.com/acacode/swagger-typescript-api/pull/1459) [`6b485dd`](https://github.com/acacode/swagger-typescript-api/commit/6b485dd70228a7e3697c4bd4a9ca5537e456f512) Thanks [@smorimoto](https://github.com/smorimoto)! - Downgrade eta from 4.0.1 to 3.5.0 to fix module resolution error.
8+
9+
After the upgrade to eta@4.0.1 in version 13.2.11, API generation started
10+
failing with `ERR_PACKAGE_PATH_NOT_EXPORTED: No "exports" main defined in
11+
eta/package.json`. This issue is caused by incorrect package export
12+
configuration in eta@4.0.1, which is tracked in the upstream repository.
13+
14+
Downgrading to eta@3.5.0 resolves the module resolution error whilst
15+
maintaining compatibility with the existing template system.
16+
17+
Fixes #1427.
18+
19+
## 13.2.15
20+
21+
### Patch Changes
22+
23+
- [`afc2448`](https://github.com/acacode/swagger-typescript-api/commit/afc24481bbbe891942264c1dacf1101e521f039a) Thanks [@js2me](https://github.com/js2me)! - added ability to override usageSchema and originalSchema after onInit hook and before all other operations
24+
25+
## 13.2.14
26+
27+
### Patch Changes
28+
29+
- [#1398](https://github.com/acacode/swagger-typescript-api/pull/1398) [`d987aee`](https://github.com/acacode/swagger-typescript-api/commit/d987aee6a2f7dbf6edba73b58a2df2fceb32a876) Thanks [@k1rd3rf](https://github.com/k1rd3rf)! - Fix modular template to always generate class property syntax.
30+
31+
The modular template was incorrectly using object method syntax (`:` and
32+
`,`) when route.namespace was present, introduced by PR #1326. This
33+
caused TypeScript syntax errors in generated code.
34+
35+
The modular template should always generate class properties with arrow
36+
functions (`=` and `;`), regardless of namespace presence.
37+
38+
This resolves the issue reported in #1366 where version 13.2.8 generated
39+
invalid TypeScript code with modular templates.
40+
341
## 13.2.13
442

543
### Patch Changes

mise.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tools]
2+
node = "25"
3+
yarn = "4"

package.json

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swagger-typescript-api",
3-
"version": "13.2.13",
3+
"version": "13.2.16",
44
"description": "Generate the API client for Fetch or Axios from an OpenAPI Specification",
55
"homepage": "https://github.com/acacode/swagger-typescript-api",
66
"bugs": "https://github.com/acacode/swagger-typescript-api/issues",
@@ -13,19 +13,18 @@
1313
"type": "module",
1414
"exports": {
1515
".": {
16-
"import": {
17-
"types": "./dist/lib.d.ts",
18-
"default": "./dist/lib.js"
19-
},
20-
"require": {
21-
"types": "./dist/lib.d.cts",
22-
"default": "./dist/lib.cjs"
23-
}
24-
}
16+
"import": "./dist/index.js",
17+
"require": "./dist/index.cjs"
18+
},
19+
"./cli": {
20+
"import": "./dist/cli.js",
21+
"require": "./dist/cli.cjs"
22+
},
23+
"./package.json": "./package.json"
2524
},
26-
"main": "./dist/lib.cjs",
27-
"module": "./dist/lib.js",
28-
"types": "./dist/lib.d.cts",
25+
"main": "./dist/index.cjs",
26+
"module": "./dist/index.js",
27+
"types": "./dist/index.d.cts",
2928
"bin": {
3029
"sta": "./dist/cli.js",
3130
"swagger-typescript-api": "./dist/cli.js"
@@ -47,36 +46,36 @@
4746
"typedoc": "typedoc"
4847
},
4948
"dependencies": {
50-
"@biomejs/js-api": "3.0.0",
51-
"@biomejs/wasm-nodejs": "2.2.4",
49+
"@biomejs/js-api": "4.0.0",
50+
"@biomejs/wasm-nodejs": "2.3.8",
5251
"@types/lodash": "^4.17.20",
5352
"@types/swagger-schema-official": "^2.0.25",
5453
"c12": "^3.3.0",
5554
"citty": "^0.1.6",
5655
"consola": "^3.4.2",
57-
"eta": "^4.0.1",
56+
"eta": "^3.5.0",
5857
"lodash": "^4.17.21",
59-
"nanoid": "^5.1.5",
58+
"nanoid": "^5.1.6",
6059
"openapi-types": "^12.1.3",
6160
"swagger-schema-official": "2.0.0-bab6bed",
6261
"swagger2openapi": "^7.0.8",
63-
"typescript": "~5.9.2",
62+
"typescript": "~5.9.3",
6463
"yaml": "^2.8.1"
6564
},
6665
"devDependencies": {
67-
"@biomejs/biome": "2.2.4",
68-
"@changesets/changelog-github": "0.5.1",
69-
"@changesets/cli": "2.29.7",
70-
"@tsconfig/node20": "20.1.6",
71-
"@tsconfig/strictest": "2.0.6",
72-
"@types/node": "24.5.2",
66+
"@biomejs/biome": "2.3.8",
67+
"@changesets/changelog-github": "0.5.2",
68+
"@changesets/cli": "2.29.8",
69+
"@tsconfig/node20": "20.1.8",
70+
"@tsconfig/strictest": "2.0.8",
71+
"@types/node": "24.10.1",
7372
"@types/swagger2openapi": "7.0.4",
74-
"axios": "1.12.2",
75-
"tsdown": "0.15.4",
76-
"typedoc": "0.28.13",
77-
"vitest": "3.2.4"
73+
"axios": "1.13.2",
74+
"tsdown": "0.16.8",
75+
"typedoc": "0.28.15",
76+
"vitest": "4.0.15"
7877
},
79-
"packageManager": "yarn@4.10.2",
78+
"packageManager": "yarn@4.12.0",
8079
"engines": {
8180
"node": ">=20"
8281
},

src/code-gen-process.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ export class CodeGenProcess {
112112
this.config.hooks.onInit(this.config, this) || this.config,
113113
);
114114

115+
if (this.config.swaggerSchema) {
116+
swagger.usageSchema = this.config.swaggerSchema;
117+
}
118+
if (this.config.originalSchema) {
119+
swagger.originalSchema = this.config.originalSchema;
120+
}
121+
115122
this.schemaComponentsMap.clear();
116123

117124
lodash.each(swagger.usageSchema.components, (component, componentName) =>

src/schema-routes/schema-routes.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ export class SchemaRoutes {
6565
]);
6666
}
6767

68-
createRequestsMap = (routeInfoByMethodsMap) => {
69-
const parameters = lodash.get(routeInfoByMethodsMap, "parameters");
68+
createRequestsMap = (routesByMethod) => {
69+
const parameters = lodash.get(routesByMethod, "parameters");
7070

7171
return lodash.reduce(
72-
routeInfoByMethodsMap,
72+
routesByMethod,
7373
(acc, requestInfo, method) => {
7474
if (
7575
method.startsWith("x-") ||
@@ -91,10 +91,9 @@ export class SchemaRoutes {
9191
);
9292
};
9393

94-
parseRouteName = (originalRouteName) => {
94+
parseRouteName = (rawRoute) => {
9595
const routeName =
96-
this.config.hooks.onPreBuildRoutePath(originalRouteName) ||
97-
originalRouteName;
96+
this.config.hooks.onPreBuildRoutePath(rawRoute) || rawRoute;
9897

9998
// TODO forbid leading symbols [\]^` in a major release (allowed yet for backwards compatibility)
10099
const pathParamMatches = (routeName || "").match(
@@ -157,15 +156,16 @@ export class SchemaRoutes {
157156
);
158157

159158
for (const paramName of paramNames) {
160-
// @ts-expect-error TS(2339) FIXME: Property 'includes' does not exist on type 'unknow... Remove this comment to see the full error message
161-
if (paramName.includes("-")) {
159+
if (typeof paramName === "string" && paramName.includes("-")) {
162160
consola.warn("wrong query param name", paramName);
163161
}
164162

165163
queryParams.push({
166164
$match: paramName,
167-
// @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
168-
name: lodash.camelCase(paramName),
165+
name:
166+
typeof paramName === "string"
167+
? lodash.camelCase(paramName)
168+
: lodash.camelCase(String(paramName)),
169169
required: true,
170170
type: "string",
171171
description: "",
@@ -178,7 +178,7 @@ export class SchemaRoutes {
178178
}
179179

180180
const result = {
181-
originalRoute: originalRouteName || "",
181+
originalRoute: rawRoute || "",
182182
route: fixedRoute,
183183
pathParams,
184184
queryParams,
@@ -241,9 +241,7 @@ export class SchemaRoutes {
241241
routeParam.name = lodash.camelCase(routeParam.name);
242242
}
243243

244-
if (routeParam) {
245-
routeParams[routeParam.in].push(routeParam);
246-
}
244+
routeParams[routeParam.in].push(routeParam);
247245
});
248246

249247
// used in case when path parameters is not declared in requestInfo.parameters ("in": "path")
@@ -418,8 +416,7 @@ export class SchemaRoutes {
418416
lodash.reduce(
419417
requestInfos,
420418
(acc, requestInfo, status) => {
421-
// @ts-expect-error TS(2554) FIXME: Expected 2 arguments, but got 1.
422-
const contentTypes = this.getContentTypes([requestInfo]);
419+
const contentTypes = this.getContentTypes([requestInfo], operationId);
423420

424421
return [
425422
...acc,

0 commit comments

Comments
 (0)