I am using NestJS Swagger module to list api end points.
Some DTO won't show in the Swagger Schema.
https://github.com/vh13294/nestjs-inventory
As you can see "FindSingleLocationInventoryDto" is not shown.



I did run "npm build" several times. Still, it shows the same result.
Nest version: 7.4.4
For Tooling issues:
- Node version: v12.18.3
- Platform: macOS catalina
Running your code, I do see that the FindSignleLocationInventoriesDto does not appear under Schemas but it is properly set up under the /inventories/findSingleLocation action on the Swagger page. If I had to bet, this is to keep the Schemas from getting overwhelmed as more Query and Param DTOs are created and to keep the Schemas section specifically for payloads that will be sent via POST, PATCH, and PUT.
After playing around with it.
It turns out that Swagger Schema only shows the DTO that are wrapped within "@Body()" decorate.
Is that intended?
not "@Query()" nor "@Param()"
Hi all,
First of all, many thanks for your amazing work, NestJs (and you guys) rocks 馃 !
As @vh13294 said, I can confirm that only DTOs wrapped within @Body() decorator are shown in the "Schema" part of the Swagger UI, but none of those wrapped within @Query() or @Param() decorators are (for my personal use case at the very least).
@jmcdo29 or @kamilmysliwiec do you have some info about it ? Or any way we can get to do what we want ?
I've seen several issues discussing about this weird behaviour (such as 114 and 299) but all of them were _locked as off topic and limited to collaborators_, why such a thing ?
Being able to provide an API documentation with every needed DTOs seems pretty relevant to me, isn't it ?
As I said before, the schemas section is meant to be reserved for request bodies that are to be sent over the wire. However, that doesn't mean your swagger file is any less documented than if the @Query() and @Param() dtos were added to the schemas, because in each request, each route, there's information about what url and query parameters are to be expected, and swagger codegen does still operate fully (currently using it at my place of work). Is there a reason you think that it should be in the schemas vs where it currently is (with each route). Even most of the examples in the Swagger docs use inline for url and query parameters and schema refs for bodies and response bodies.
all of them were _locked as off topic..._ why such a thing?
Because people can get really whiny when you tell them this isn't a bug and they'll generate a lot of noise that distracts us from enhancements. Nest is an opinionated framework, and it's our opinion that this is how we should set up the swagger document. You could always write some transformation code if you really feel the need to, but at the end of the day, what we have running works, and is pretty clean on the swagger side of things, in my opinion.