Customizing the validator compiler
Fastify exposes a lot of options to provide a flexible validation process and complete control of it. We are going to explore all the possible customizations one by one, so you will be a validator compiler guru by the end of this section! Let’s jump into this journey one step at a time!
Flow control
In the previous section, we mentioned the attachValidation
route option – it’s time to look at an example (although you probably already know how to use it, thanks to the previous chapters):
app.get('/attach-validation', {   attachValidation: true,   schema: {     headers: jsonSchemaHeaders   },   handler: (request, reply) => {     reply.send(request.validationError)   } })
Adding the flag into the route option will prevent a validation error from being thrown. Instead, the validation execution process will be interrupted...