swagger: [Regression] Swagger generates empty schemas
I’m submitting a…
- Regression
- Bug report
- Feature request
- Documentation issue or request
- Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
All swagger schemas are empty and contain no information at all.

Expected behavior
Documentation detailing the property types on schemas should be inferred from the typescript definitions as described here and here. Like so:

Minimal reproduction of the problem with instructions
Reproduction: https://github.com/robertmain/meal-plan/tree/update-swagger
Instructions:
- Download the app from the link above (the branch is important!)
1 Install the dependencies and navigate to
localhost:3000/api(yeah, I know it’s a crappy URL scheme…I’m working on it)
What is the motivation / use case for changing the behavior?
Empty API documentation isn’t very useful…? 🤔
Environment
Nest version: 6.6.4
For Tooling issues:
- Node version: 10.16.3
- Platform: Debian Linux 9
Others:
Contents of nest-cli.json
{
"language": "ts",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"plugins": ["@nestjs/swagger/plugin"]
}
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 37 (5 by maintainers)
Same for me. Newest Nest Version using newest cli with
nest new, added the plugin to nest-cli.json and it produces empty models. I’m using docker, but I’m also copying the nest-cli.json into that containerUPDATE:
Please bury me alive, I did’nt use .dto.ts files (yet) but .type.ts files. I had to adjust the “dtoFileNameSuffix” therefore. Now it’s working for me!
I’m encountering the same issue. If I don’t add
@ApiProperty()the prop will not show up in the schema.Using version 4.1.2
I’ve downgraded back to 4.0.9, which seems to work as described in the docs for now.
Yeah,
Stringin typescript refers to theString.prototypeobject…not an actual string 😉I didn’t get any further yet, no. I’ve kinda set that problem to one side until one of the framework developers chips in here with some insight. Right now I’m trying to get serve-static working with webpack hot reloading.
When I get to it, sure. I’ll post it in here
On Thu, Jan 9, 2020, 10:10 Hwan-seok notifications@github.com wrote:
@Hwan-seok I haven’t had chance to test it yet, sorry.
@robertmain Did you solved after build through webpack?
My project already using
nest buildbut I have same issue as youEntire project has latest nest modules but it dosen’t work… My global version of nest/cli and typescript are same as follows’ devDependencies
Here's my package.json
I’m sorry about not being able to provide reproduction repo, it’s a company project.
Not exactly. Here you can find a breakdown of all the available CLI properties: https://docs.nestjs.com/cli/monorepo#cli-properties. Both files serve a slightly different purpose. To better understand what
nest buildis doing, you can read this short explanation https://docs.nestjs.com/cli/scripts#build