Validating package payload

This example shows how can we attach some metadata information with a given constraint declaration by using it's element 'payload'.In this example we are going to make decision on the level of error severity to take action.I'm still not sure what the point is of severity though, sure you get a warning in your form, but you'll never see it if the form was valid.Recently, during a pair programming session, I had a really interesting discussion.Of course, you can define your validation rules of choice.Within Joi’s API documentation, you’ll find all applicable methods.Multiple ideas appeared so I’d like to present them here.The very first approach assumes we leverage intermediate layer just after routing (sometimes even within a router) and before a controller to provide specific validations.

This guide shows you how to use joi and configure payload validation for incoming requests on a given route.If you didn’t define any validation, hapi skips this step and proceeds with the route handler.In case you’ve payload validation in place, hapi applies the defined constraints.Depending on whether the given payload data passes the validation process successfully, the request will be proceeded by calling the route handler.If validation fails, hapi will reply with a detailed boom error object including the reason why validation failed.

Search for validating package payload:

validating package payload-12validating package payload-35validating package payload-16validating package payload-14

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “validating package payload”