Skip to content

Commit 52ce877

Browse files
committed
update(): add swagger configs
1 parent 072a94b commit 52ce877

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

nest-cli.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"language": "ts",
3-
"collection": "@nestjs/schematics",
4-
"sourceRoot": "src"
2+
"language": "ts",
3+
"collection": "@nestjs/schematics",
4+
"sourceRoot": "src",
5+
"compilerOptions": {
6+
"plugins": ["@nestjs/swagger/plugin"]
7+
}
58
}

src/decorators/swagger.schema.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
/* eslint-disable @typescript-eslint/naming-convention */
12
import { ApiBody } from '@nestjs/swagger';
23
import { SchemaObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
34

4-
// eslint-disable-next-line @typescript-eslint/naming-convention
55
export const ApiFile = (
66
fileName = 'file',
77
options: Partial<{ isRequired: boolean; isArray: boolean }> = {},
@@ -22,9 +22,8 @@ export const ApiFile = (
2222
items: fileSchema,
2323
};
2424
}
25-
ApiBody({
25+
return ApiBody({
2626
required: isRequired,
27-
type: 'multipart/form-data',
2827
schema: {
2928
type: 'object',
3029
properties: {

webpack.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ module.exports = {
1616
rules: [
1717
{
1818
test: /\.tsx?$/,
19-
use: 'ts-loader',
19+
loader: 'ts-loader',
2020
exclude: /node_modules/,
21+
options: {
22+
getCustomTransformers: (program) => ({
23+
before: [require('@nestjs/swagger/plugin').before({}, program)]
24+
}),
25+
},
2126
},
2227
],
2328
},

0 commit comments

Comments
 (0)