Skip to content

Commit 2fff0db

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e41794f + 666fec3 commit 2fff0db

File tree

78 files changed

+3367
-2416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3367
-2416
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ module.exports = {
3131
],
3232
'@typescript-eslint/no-explicit-any': 'off',
3333
'@typescript-eslint/no-unsafe-assignment': 'off',
34-
'@typescript-eslint/no-unsafe-call': 'off',
3534
'@typescript-eslint/no-unsafe-argument': 'off',
3635
'@typescript-eslint/no-unsafe-member-access': 'off',
3736
'@typescript-eslint/no-unsafe-return': 'off',

.github/workflows/closeStaleIssuesAndPRs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
repo-token: ${{ secrets.GITHUB_TOKEN }}
1313
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
1414
stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
15-
days-before-stale: 30
16-
days-before-close: 5
15+
days-before-stale: 150
16+
days-before-close: 30
1717
exempt-issue-labels: 'help wanted,Pending feedback'
1818
exempt-pr-labels: 'help wanted,breaking change'

.github/workflows/runTestsOnPush.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
matrix:
99
node-version: [18, 20, 21]
1010
os: [macos-latest, ubuntu-latest, windows-latest]
11-
typescript-version: ['^4.9.5', '^5.2.2']
11+
typescript-version: ['^5.0.0']
1212

1313
steps:
1414
- uses: actions/checkout@master
1515

1616
- name: Setup Node
17-
uses: actions/setup-node@v3
17+
uses: actions/setup-node@v4
1818
with:
1919
node-version: ${{ matrix.node-version }}
2020
cache: yarn

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "6.4.0",
2+
"version": "6.5.1",
33
"npmClient": "yarn",
44
"command": {
55
"version": {

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
"eslint": "^8.56.0",
5050
"eslint-config-prettier": "^9.1.0",
5151
"husky": "^4.3.0",
52-
"lerna": "^8.0.1",
53-
"lint-staged": "^15.2.0",
54-
"prettier": "^3.1.1",
52+
"lerna": "^8.1.8",
53+
"lint-staged": "^15.2.10",
54+
"prettier": "^3.3.3",
5555
"ts-node": "^10.9.2",
56-
"typedoc": "^0.25.12"
56+
"typedoc": "^0.26.7"
5757
},
5858
"resolutions": {
5959
"typescript": "^5.2.2"

packages/cli/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tsoa/cli",
33
"description": "Build swagger-compliant REST APIs using TypeScript and Node",
4-
"version": "6.4.0",
4+
"version": "6.5.1",
55
"main": "./dist/index.js",
66
"typings": "./dist/index.d.ts",
77
"files": [
@@ -30,25 +30,25 @@
3030
"author": "Luke Autry <[email protected]> (http://www.lukeautry.com)",
3131
"license": "MIT",
3232
"dependencies": {
33-
"@tsoa/runtime": "^6.4.0",
34-
"@types/multer": "^1.4.11",
33+
"@tsoa/runtime": "^6.5.1",
34+
"@types/multer": "^1.4.12",
3535
"fs-extra": "^11.2.0",
3636
"glob": "^10.3.10",
3737
"handlebars": "^4.7.8",
38-
"merge-anything": "^5.1.4",
38+
"merge-anything": "^5.1.7",
3939
"minimatch": "^9.0.1",
40-
"ts-deepmerge": "^7.0.0",
41-
"typescript": "^5.3.3",
42-
"validator": "^13.11.0",
43-
"yaml": "^2.4.1",
40+
"ts-deepmerge": "^7.0.2",
41+
"typescript": "^5.7.2",
42+
"validator": "^13.12.0",
43+
"yaml": "^2.6.1",
4444
"yargs": "^17.7.1"
4545
},
4646
"devDependencies": {
4747
"@types/glob": "^8.1.0",
4848
"@types/minimatch": "^5.1.0",
4949
"@types/node": "^18.0.0",
50-
"@types/validator": "^13.11.7",
51-
"@types/yargs": "^17.0.32",
50+
"@types/validator": "^13.12.2",
51+
"@types/yargs": "^17.0.33",
5252
"copyfiles": "^2.4.1",
5353
"rimraf": "^5.0.5"
5454
},

packages/cli/src/cli.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,3 +397,11 @@ export async function generateSpecAndRoutes(args: SwaggerArgs, metadata?: Tsoa.M
397397
throw err;
398398
}
399399
}
400+
export type RouteGeneratorModule<Config extends ExtendedRoutesConfig> = {
401+
default: new (
402+
metadata: Tsoa.Metadata,
403+
routesConfig: Config,
404+
) => {
405+
GenerateCustomRoutes: () => Promise<void>;
406+
};
407+
};

packages/cli/src/metadataGeneration/exceptions.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export class GenerateMetadataError extends Error {
1111
}
1212

1313
export class GenerateMetaDataWarning {
14-
constructor(private message: string, private node: Node | TypeNode, private onlyCurrent = false) { }
14+
constructor(
15+
private message: string,
16+
private node: Node | TypeNode,
17+
private onlyCurrent = false,
18+
) {}
1519

1620
toString() {
1721
return `Warning: ${this.message}\n${prettyLocationOfNode(this.node)}\n${prettyTroubleCause(this.node, this.onlyCurrent)}`;
@@ -34,9 +38,9 @@ export function prettyLocationOfNode(node: Node | TypeNode) {
3438
export function prettyTroubleCause(node: Node | TypeNode, onlyCurrent = false) {
3539
let name: string;
3640
if (onlyCurrent || !node.parent) {
37-
name = node.pos !== -1 ? node.getText() : ((node as any).name?.text || '<unknown name>');
41+
name = node.pos !== -1 && node.parent ? node.getText() : (node as any).name?.text || '<unknown name>';
3842
} else {
39-
name = node.parent.pos !== -1 ? node.parent.getText() : ((node as any).parent.name?.text || '<unknown name>');
43+
name = node.parent.pos !== -1 ? node.parent.getText() : (node as any).parent.name?.text || '<unknown name>';
4044
}
4145
return `This was caused by '${name}'`;
4246
}

packages/cli/src/metadataGeneration/extension.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ export function getExtensions(decorators: ts.Identifier[], metadataGenerator: Me
1212

1313
const [decoratorKeyArg, decoratorValueArg] = extensionDecorator.parent.arguments;
1414

15-
if (!ts.isStringLiteral(decoratorKeyArg)) {
15+
if (!ts.isStringLiteral(decoratorKeyArg) && !ts.isIdentifier(decoratorKeyArg)) {
1616
throw new Error('The first argument of @Extension must be a string');
1717
}
1818

19-
const attributeKey = decoratorKeyArg.text;
19+
const attributeKey = ts.isIdentifier(decoratorKeyArg) ? getInitializerValue(decoratorKeyArg, metadataGenerator.typeChecker) : decoratorKeyArg.text;
20+
21+
if (typeof attributeKey !== 'string') {
22+
throw new Error('The first argument of @Extension must be a string');
23+
}
2024

2125
if (!decoratorValueArg) {
2226
throw new Error(`Extension '${attributeKey}' must contain a value`);

packages/cli/src/metadataGeneration/methodGenerator.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ export class MethodGenerator {
197197

198198
return decorators.map(decorator => {
199199
const [name, description, example, produces] = getDecoratorValues(decorator, this.current.typeChecker);
200-
responseExamplesByName[name] = responseExamplesByName[name] ? [...responseExamplesByName[name], example] : [example];
200+
201+
if (example !== undefined) {
202+
responseExamplesByName[name] = responseExamplesByName[name] ? [...responseExamplesByName[name], example] : [example];
203+
}
204+
201205
return {
202206
description: description || '',
203207
examples: responseExamplesByName[name] || undefined,

0 commit comments

Comments
 (0)