Nest plugin can be found under your node_modules directory under: @nestjs/swagger/dist/plugin
This should be set in your complier options:
"compilerOptions": {
"plugins": ["@nestjs/swagger/dist/plugin"]
}
Answer from Nico on Stack OverflowNest plugin can be found under your node_modules directory under: @nestjs/swagger/dist/plugin
This should be set in your complier options:
"compilerOptions": {
"plugins": ["@nestjs/swagger/dist/plugin"]
}
I had exactly the same issue.
I solved it with this:
- Make sure you have nestcli installed:
npm i -g @nestjs/cli - Update nestcli on deployment before you make npm install:
nest update - If this not helps, try another Swagger-Version. I had the problem with version 4.5.9, I upgraded to
@nestjs/swagger": "^4.5.11and it helped.
Hope this works for you.
It was an issue with global dependencies conflicting with local ones, as well as the old build (set to incremental mode) conflicting with the new property generation. Did the following to resolve the issue:
- If nest cli is globally installed, manually upgrade it:
yarn global upgrade upgrade @nestjs/cli, or with npm (npm update -g @nestjs/cli) - Upgrade local service nest to most recent version:
nest update - Add the following to your
nest-cli.json:
"compilerOptions": {
"plugins": ["@nestjs/swagger/plugin"]
}
- Remove your local dist folder (or do a yarn build)
- Start the server with the nest cli commands (i.e.
nest startornest start:dev)
My fix was...
The plugin filters the files it looks up based on a suffix rule.
- If you use a different naming convention than Angular's, you need to pass custom plugin options to fix it;
- If your controller or Dto is not inside a file with the name suffix, it wont be upgraded.
» npm install @nestjs/swagger
» npm install typescript-nestjs-swagger-plugin
You may have forgotten to load metadata (that was generated by the plugin).
From https://docs.nestjs.com/openapi/cli-plugin#swc-builder
import metadata from './metadata';
...
await SwaggerModule.loadPluginMetadata(metadata);
const document = SwaggerModule.createDocument(app, config);
do you know that the plugin won't touch source files, right? you can compare the .dto.js with and without the plugin enabled