[Regression] Swagger generates empty schemas
See original GitHub issueI’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"]
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:37 (5 by maintainers)
Top Results From Across the Web
Swagger 3.0.0 - doesn't see schema for @RequestBody
my Rest controller looks like this: @RestController @RequestMapping("/path", produces = [MediaType.APPLICATION_JSON_VALUE]) @Validated class ...
Read more >Components Section - Swagger
Under components , the definitions are grouped by type – schemas , parameters and so on. The following example lists the available subsections....
Read more >NestJS: Ultimate API documentation with Swagger - Medium
The documentation is generated but you notice that if you open the “InventoryItemCreateDTO”, the schema is empty! To solve this problem, we need...
Read more >drf-yasg - Yet another Swagger generator - Read the Docs
Generate real Swagger/OpenAPI 2.0 specifications from a Django Rest Framework ... generated Swagger schema can be automatically validated by swagger-spec- ...
Read more >apispec - Read the Docs
from marshmallow import Schema, fields. # Create an APISpec spec = APISpec( title="Swagger Petstore", version="1.0.0", openapi_version="3.0.2",.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.