I have a simple nest controller with validation pipe decorator
import {GetCatDto} from 'my-shared-lib'
@Controller('myController')
export class MyController {
constructor(private readonly policyManagerService: PolicyManagerService) {}
@Get()
@UsePipes(new ValidationPipe({ transform: true }))
getCat(@Query() getCatDto: GetCatDto) {
return this.catService.getcates(getCatDto);
}
in the shared lib (imported using npm link) :
export class getCatDto {
@Expose({ name: 'cat_name' })
catName: string;
}
if I send the following get request : GET localhost:3000/myController?Cat-Name=mycat
I don't get validation error.
BUT.. If I copy/paste the dto into my project (i.e in the same file as the controller). the validation works as expected.
at first I thought it might be be related to this issue but my tsconfig.json
includes the mentioned headers.
I'm using nest.js 8.0.0 and class-validator 0.13.2