-
Hello, I created a new Pipe for The validation using Class-Validator but i'm nota seeing the way to correctly implement it inside my server.ts to be used for all the routes. I did the override method for the default ValidationPipe. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @VicAlar Also any issue related to class-validator/Ts.ED won't be supported by us! But the solution is the following import {ValidationPipe} from "@tsed/platform-params";
import {JsonParameterStore} from "@tsed/schema";
import {OverrideProvider} from "@tsed/di";
@OverrideProvider(ValidationPipe)
export ClassValidatorPipe extends ValidationPipe {
async transform(value: any, metadata: JsonParameterStore): Promise<any> {
/// do something
}
} Then in import "./pipes/ClassValidatorPipe"; It should works. See you |
Beta Was this translation helpful? Give feedback.
Hello @VicAlar
Override ValidationPipe isn't encouraged because Ts.ED use
@tsed/schema
to map object, validate it and generate documentation.Removing one of this point downgrade the Dev experience with Ts.ED.
Also any issue related to class-validator/Ts.ED won't be supported by us!
But the solution is the following
Then in
Server.ts
add the following code:im…