Validate Model

Validates data against a model. If the validation fails, Node can either throw an error or output on an error path.

You can use the Validate Model Node to validate a model of your choosing. The model can be predefined, or created just for the Node.

Validate Model Node Configuration

You can configure the Node to either output on an output when validation fails, or throw an error. Data refers the object that will be validated against the chosen Model.

Consider the following Workflow:

We have our Validate Model Node configured like in the first picture. Our API Request Node is configured for endpoint person with a post method. We intend on validating the data coming into the API against the following model.

Model Being Validated

Our model indicates that the firstName and lastName properties are required. In addition, we've set display names for each property to give the consumer a user friendly error message, as our hypothetical API will be consumed via a web app.

Using Postman to test our API yields the following results:

Learn more about Models: