Creates a validation condition that uses a Zod schema to validate and optionally transform input.
This condition is marked as a validator for the @contract decorator, meaning it can modify the input.
classMyService { @contract({ requires: [validates(UserSchema)], }) asyncprocessUser(user: z.infer<typeofUserSchema>) { // user is guaranteed to conform to UserSchema here console.log("Processing user:", user); } }
Creates a validation condition that uses a Zod schema to validate and optionally transform input. This condition is marked as a validator for the
@contract
decorator, meaning it can modify the input.