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

@ApiQuery does not work properly with fastify #2864

Closed
2 of 4 tasks
maioradv opened this issue Mar 4, 2024 · 1 comment
Closed
2 of 4 tasks

@ApiQuery does not work properly with fastify #2864

maioradv opened this issue Mar 4, 2024 · 1 comment

Comments

@maioradv
Copy link

maioradv commented Mar 4, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

I'm passing an object in the query params using the validation pipe that consent only whitelisted properties

?filters[name]=asc

that's the message that returns me using fastify
["property filters[name] should not exist"]

but with express works well

Minimum reproduction code

https://codesandbox.io/p/devbox/brave-christian-c22g5q?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clssokgns0007356hb14awecx%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clssokgnr0002356hexe3ch7w%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clssokgnr0004356hzvmciyvx%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clssokgns0006356h6j4h35i9%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clssokgnr0002356hexe3ch7w%2522%253A%257B%2522id%2522%253A%2522clssokgnr0002356hexe3ch7w%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clssokgnq0001356hye8i8apd%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252FREADME.md%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clssokgnq0001356hye8i8apd%2522%257D%252C%2522clssokgns0006356h6j4h35i9%2522%253A%257B%2522id%2522%253A%2522clssokgns0006356h6j4h35i9%2522%252C%2522activeTabId%2522%253A%2522cltctj4fd00pl356heu9h32ck%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522start%253Adev%2522%252C%2522port%2522%253A3000%252C%2522id%2522%253A%2522cltctj4fd00pl356heu9h32ck%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522path%2522%253A%2522%2522%257D%255D%257D%252C%2522clssokgnr0004356hzvmciyvx%2522%253A%257B%2522id%2522%253A%2522clssokgnr0004356hzvmciyvx%2522%252C%2522activeTabId%2522%253A%2522cltcvb9dc01q8356h5f4e1ppl%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clssorj3300vu356hlya0u1s5%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522cltcv86fg000xdje68znu81hh%2522%257D%252C%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522start%253Adev%2522%252C%2522id%2522%253A%2522cltcvb9dc01q8356h5f4e1ppl%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%255D%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

Steps to reproduce

visit this route /asdasd?filters[name]=asc
you can switch from fastify to express from main.ts

Expected behavior

same behaviour of express

Package version

7.3.0

NestJS version

10.3.3

Node.js version

20.11.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

"dependencies": {
"@nestjs/common": "^10.3.2",
"@nestjs/core": "^10.3.2",
"@nestjs/platform-express": "^10.3.2",
"@nestjs/platform-fastify": "^10.3.0",
"reflect-metadata": "^0.2.1",
"rxjs": "^7.8.1",
"@nestjs/mapped-types": "*",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"@nestjs/swagger": "^7.2.0"
},

@kamilmysliwiec
Copy link
Member

Would you like to create a PR for this issue?

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