I'm not sure since when the schemas are not being shown but I do have the nest-cli.json file configured as documentation says. And the schema classes are in the swagger ui but with no properties , not sure if its because of my nest version but ideally, updates shouldn't affect my application. This is a recent issue.
#Schemas in swagger are not being shown
43 messages · Page 1 of 1 (latest)
Sure, here it is. It was working before
I've already tried this
looks good to me 🤔
the swagger looks like this, it has the class but with no properties
and it works if I add the @ApiProperty decorator in my DTO, but as I said it was working before and I would like to avoid doing that because I'd have a lot of DTOs to edit
Just double checking, you aren't using a monorepo here, are you? These classes just exist in the project root? What are the file names?
Nope, I'm not using monorepo
for example, the name of that file is user-registration.dto.ts
according with the docs, it should work
Can you get us a reproduction showing it not working? This seems like it should be fine
does this works for you?
Please run the command npx -y @nestjs/cli info and paste the output in a code block. This will help us determine if there is a version issue in your packages and which version of nest we are triaging.
it's a private repo and the project is a bit old 😅 that's why I was asking if it has to do with the version
I don;'t recall if v7 worked with the swagger cli. I'd have to go find when that was added in
[System Information]
OS Version : Linux 5.10
NodeJS Version : v20.10.0
YARN Version : 1.22.19
[Nest CLI]
Nest CLI Version : 7.6.0
[Nest Platform Information]
platform-express version : 7.6.18
passport version : 7.1.0
swagger version : 4.7.5
typeorm version : 7.1.0
common version : 7.6.18
config version : 0.5.0
bull version : 10.0.1
core version : 7.6.18
jwt version : 7.1.0
But it was working before
so what you changed from the working version?
Okay, v7 does have swagger cli support
But yeah, definitely would need a repo to try and figure out what the issue is
Honestly, I'm not sure since when it stopped working so I have no clue
let me check again
I'd suggest you to create a small project using v7 to try to reproduce it again then
okok
Ok... I'm trying to create a new project using v7 and when I do build I get:
Error "@nestjs/swagger" plugin could not be found!
what about npx nest info
OS Version : macOS Unknown
NodeJS Version : v18.18.0
YARN Version : 1.22.19
[Nest CLI]
Nest CLI Version : 7.6.0
[Nest Platform Information]
platform-express version : 7.6.15
swagger version : 7.1.17
common version : 7.6.15
core version : 7.6.15```
I've already solved that, it was the swagger version
sorry hehe I'll continue to reproduce the other error
Having the same issue
Ity's most likely an issue with the typesdcript version mixed with the swagger version. This is one of those hard to debug things that I forget what it shiould be explicitly set to
Essentially, the plugin correctly sees the files, but due to changes in the Tyepscript API the decorators don't get added correctly, so it looks like it isn't working
I'd check each version explicitly from 4.2.0 on until you find the one that works
yarn add -D typescript@~4.2 makes this work as expected. I haven't tested how for it goes yet
now I'm getting this
Yeah, that's an issue with the babel types which jest relies on and the typescript verison. I just removed jest to see if it was working