To quickly accomplish this, add the Sometimes you may wish to add validation rules based on more complex conditional logic.

This message should be placed in the first level of the array, not within the When creating a custom validation rule, you may sometimes need to define custom place-holder replacements for error messages.

provides a declarative way of validating javascript objects.

Or, you may need two fields to have a given value only when another field is present.

Adding these validation rules doesn't have to be a pain.

First, let's assume we have the following routes defined in our object.

If the validation rules pass, your code will keep executing normally; however, if validation fails, an exception will be thrown and the proper error response will automatically be sent back to the user.

Sometimes you may wish to stop running validation rules on an attribute after the first validation failure.

To do so, assign the So, what if the incoming request parameters do not pass the given validation rules?

First, create a Let's assume our web application is for game collectors.