Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending using PartialType, OmitType… doesn't copy properties decorators #1174

Closed
2 of 4 tasks
mlbonniec opened this issue Aug 9, 2023 · 3 comments
Closed
2 of 4 tasks

Comments

@mlbonniec
Copy link

mlbonniec commented Aug 9, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Hi, I've noticed that when extending a class (Child) from another (Parent), using PartialType (for example, but this is the same with the other wrappers) doesn't add the Parent properties decorators to the Child.

How did I notice this ? I've some swagger @ApiProperty() decorators in my CreateDto, and when extending the UpdateDto extends PartialType(CreateDto) {}, the UpdateDto doesn't have any properties in the Swagger.``

However, removing the PartialType wrapper "fix" the issue.

Reproduction

https://stackblitz.com/edit/nestjs-issue-minimum-repro-starter-2zmyjl

Expected behavior

All the Parent properties decorators should be copied to the Child.

Package version

2.0.2

Node.js version

18.16.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@micalevisk
Copy link
Member

Please provide a minimum reproduction repository. You can start from this minimal project.

why reproductions are required

@mlbonniec
Copy link
Author

@micalevisk I've updated the original message, sorry :)

@kamilmysliwiec
Copy link
Member

If you're using swagger, then you should use PartialType from @nestjs/swagger, not @nestjs/mapped-types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants