Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(warn): deprecation of config multer options #1695

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading