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

properties decorated with @ApiHideProperty() are being displayed in swagger UI #2901

Closed
2 of 4 tasks
its-dibo opened this issue Mar 29, 2024 · 1 comment
Closed
2 of 4 tasks

Comments

@its-dibo
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

I use @ApiHideProperty() to decorate some properties, but I see them displayed in swagger UI

this is my Entity

@Entity('users')
export class UserEntity {
  @PrimaryGeneratedColumn('uuid')
  @ApiHideProperty()
  @Exclude()
  id: string;

// other props
}

this is Swagger setup

 let app = await NestFactory.create(AppModule);
 let swaggerConfig = new DocumentBuilder() .build();
 let document = SwaggerModule.createDocument(app, swaggerConfig);
 SwaggerModule.setup('', app, document);
app.listen(3000)

Minimum reproduction code

.

Steps to reproduce

No response

Expected behavior

the id property is hidden from the schema, particularly when creating a resource i.e. POST /users

image

Package version

7.1.16

NestJS version

10.2.10

Node.js version

20.10.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@kamilmysliwiec
Copy link
Member

Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).

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

No branches or pull requests

2 participants