Using CacheInterceptor on endpoint and returning classes using class-validator decorators and applying @Excluded() decorator is not excluding the attribute in the cached response. #148
Labels
bug
Something isn't working
Is there an existing issue for this?
Current behavior
When applying the CacheInterceptor on endpoints and returning classes that use class-validator decorators, the application of the
@Excluded()
decorator doesn't seem to exclude the attribute in the cached response. In the non-cached response it works as expected.POST-CREATION: This applies only if you are using a redis store. I'm using cache-manager-redis-yet with version 4.1.1. Maybe i should redirect this issue on their repo.
Minimum reproduction code
https://github.com/nestjs/cache-manager
Steps to reproduce
@Excluded()
decorator applied on an attribute.Check the initial response which should NOT return the excluded attribute, as expected. (non-cached response)
Check the second response which should NOT return the excluded attribute, but surprisingly, the cache is not taking this into account and it also returns the excluded attribute. (cached response)
Expected behavior
The attribute exclusion should also apply to the cached response.
Package version
1.0.0
NestJS version
9.4.0
Node.js version
18.13.0
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: