Skip to content

Commit

Permalink
chore(warn): deprecation of config multer options (#1695)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackey8616 authored Oct 5, 2024
1 parent d8c881a commit e10185b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/cli/src/module/generate-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Tsoa } from '@tsoa/runtime';
import { DefaultRouteGenerator } from '../routeGeneration/defaultRouteGenerator';
import { fsMkDir } from '../utils/fs';
import path = require('path');
import { Config as BaseConfig } from "@tsoa/runtime";
import { Config as BaseConfig } from '@tsoa/runtime';

export async function generateRoutes<Config extends ExtendedRoutesConfig>(
routesConfig: Config,
Expand All @@ -15,7 +15,7 @@ export async function generateRoutes<Config extends ExtendedRoutesConfig>(
* pass in cached metadata returned in a previous step to speed things up
*/
metadata?: Tsoa.Metadata,
defaultNumberType?: BaseConfig['defaultNumberType']
defaultNumberType?: BaseConfig['defaultNumberType'],
) {
if (!metadata) {
metadata = new MetadataGenerator(routesConfig.entryFile, compilerOptions, ignorePaths, routesConfig.controllerPathGlobs, routesConfig.rootSecurity, defaultNumberType).Generate();
Expand All @@ -26,6 +26,15 @@ export async function generateRoutes<Config extends ExtendedRoutesConfig>(
await fsMkDir(routesConfig.routesDir, { recursive: true });
await routeGenerator.GenerateCustomRoutes();

if (routesConfig.multerOpts) {
console.warn(
'Config MulterOptions is deprecated since v6.4.0 instroduces RegisterRoutes can pass multerOptions,' +
'we will quickly remove this options soon at future version.' +
'(https://github.com/lukeautry/tsoa/issues/1587#issuecomment-2391291433)' +
'(https://github.com/lukeautry/tsoa/pull/1638)',
);
}

return metadata;
}

Expand Down
5 changes: 5 additions & 0 deletions packages/runtime/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export interface Config {
* @example {
* "dest": "/tmp"
* } Allow multer to write to file instead of using Memory's buffer
* @deprecated
* since v6.4.0 instroduces RegisterRoutes can pass multerOptions,
* we will quickly remove this options soon at future version.
* (https://github.com/lukeautry/tsoa/issues/1587#issuecomment-2391291433)
* (https://github.com/lukeautry/tsoa/pull/1638)
*/
multerOpts?: MulterOpts;

Expand Down

0 comments on commit e10185b

Please sign in to comment.