#Schemas in swagger are not being shown

43 messages · Page 1 of 1 (latest)

limber basin
#

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.

balmy patrol
#

can you show us that DTO class?

#

also, delete the dist dir and run the start again

limber basin
#

Sure, here it is. It was working before

limber basin
balmy patrol
limber basin
#

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

valid rover
#

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?

limber basin
#

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

valid rover
#

Can you get us a reproduction showing it not working? This seems like it should be fine

limber basin
valid rover
#

No, I'd need a repo that shows this behavior

#

Whoa, you're back on Nest v7?

waxen chasmBOT
#

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.

limber basin
#

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

balmy patrol
#

could be

#

but I guess we can't tell for sure without a repro

valid rover
#

I don;'t recall if v7 worked with the swagger cli. I'd have to go find when that was added in

limber basin
#
[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

balmy patrol
valid rover
#

Okay, v7 does have swagger cli support

#

But yeah, definitely would need a repo to try and figure out what the issue is

limber basin
#

let me check again

balmy patrol
#

I'd suggest you to create a small project using v7 to try to reproduce it again then

limber basin
#

okok

limber basin
#

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!

balmy patrol
#

what about npx nest info

limber basin
#
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

valid rover
#

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

limber basin
#

now I'm getting this

valid rover
#

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