Created
June 28, 2023 09:15
-
-
Save bruno-de-queiroz/d77681da9b9eaf75c7f18bc438a98446 to your computer and use it in GitHub Desktop.
nestjs/swagger 7.0.10 default values bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Controller, Get, Query } from '@nestjs/common'; | |
| import { PageDto } from './page.dto'; | |
| @Controller() | |
| export class AppController { | |
| @Get() | |
| test(@Query() page: PageDto) { | |
| return { value: `${page.sort}` }; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Module } from '@nestjs/common'; | |
| import { AppController } from './app.controller'; | |
| @Module({ | |
| controllers: [AppController] | |
| }) | |
| export class AppModule { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { NestFactory } from '@nestjs/core'; | |
| import { AppModule } from './app.module'; | |
| import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; | |
| async function bootstrap() { | |
| const app = await NestFactory.create(AppModule); | |
| // Setting up swagger | |
| const document = SwaggerModule.createDocument( | |
| app, | |
| new DocumentBuilder() | |
| .setTitle('test') | |
| .setDescription('bug') | |
| .setVersion('1.0.0') | |
| .build() | |
| ); | |
| SwaggerModule.setup('/documentation', app, document); | |
| await app.listen(3000); | |
| } | |
| bootstrap(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://json.schemastore.org/nest-cli", | |
| "collection": "@nestjs/schematics", | |
| "compilerOptions": { | |
| "deleteOutDir": true, | |
| "plugins": [ | |
| { | |
| "name": "@nestjs/swagger", | |
| "options": { | |
| "dtoFileNameSuffix": [ | |
| ".dto.ts" | |
| ] | |
| } | |
| } | |
| ] | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "swagger-bug", | |
| "version": "1.27.2", | |
| "description": "Gist", | |
| "license": "MIT", | |
| "scripts": { | |
| "build": "nest build", | |
| "start": "nest start" | |
| }, | |
| "dependencies": { | |
| "@nestjs/common": "^9.4.3", | |
| "@nestjs/config": "^3.0.0", | |
| "@nestjs/core": "^9.4.3", | |
| "@nestjs/platform-express": "^9.4.3", | |
| "@nestjs/swagger": "^7.0.10" | |
| }, | |
| "devDependencies": { | |
| "@nestjs/cli": "^10.0.5", | |
| "@nestjs/schematics": "^10.0.1", | |
| "@nestjs/testing": "^9.4.3", | |
| "@types/express": "^4.17.17", | |
| "@types/node": "^20.3.2", | |
| "@typescript-eslint/eslint-plugin": "^5.60.1", | |
| "@typescript-eslint/parser": "^5.60.1", | |
| "eslint": "^8.43.0", | |
| "eslint-config-prettier": "^8.8.0", | |
| "eslint-plugin-prettier": "^4.2.1", | |
| "eslint-plugin-unused-imports": "^2.0.0", | |
| "prettier": "^2.8.8", | |
| "source-map-support": "^0.5.21", | |
| "ts-jest": "^29.1.0", | |
| "ts-loader": "^9.4.3", | |
| "ts-node": "^10.9.1", | |
| "tsconfig-paths": "^4.0.0", | |
| "typescript": "^5.1.3" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class PageDto { | |
| readonly offset: number = 0; | |
| readonly limit: number = 10; | |
| readonly sort: string = 'createdAt DESC'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "extends": "./tsconfig.json", | |
| "exclude": [ | |
| "node_modules", | |
| "dist", | |
| "test", | |
| "**/*spec.ts", | |
| "**/*spec.*.ts", | |
| "**/__mocks__/**/*.ts" | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "compilerOptions": { | |
| "module": "commonjs", | |
| "declaration": true, | |
| "removeComments": true, | |
| "emitDecoratorMetadata": true, | |
| "experimentalDecorators": true, | |
| "allowSyntheticDefaultImports": true, | |
| "target": "ES2019", | |
| "sourceMap": true, | |
| "outDir": "./dist", | |
| "baseUrl": "./", | |
| "incremental": true, | |
| "skipLibCheck": true | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment