JSONSchema Validation
AI-generatedOverview
This node performs JSON Schema validation on incoming data items. It validates each input item against a user-defined JSON Schema and outputs only those items that conform to the schema. If an item does not match the schema, the node can either stop execution with an error or continue processing, outputting error details for the invalid items. This node is useful for data validation scenarios where ensuring data structure and types conform to a specific schema is critical, such as validating API responses, user inputs, or data before further processing.
Use Case Examples
- Validating incoming JSON data against a predefined schema to ensure it contains required fields and correct data types before processing.
- Filtering out invalid data entries in a workflow by validating each item against a JSON Schema and handling errors gracefully.
Properties
| Name | Meaning |
|---|---|
| Input Schema | The JSON Schema definition used to validate each input data item. It defines the expected structure, types, and constraints of the input JSON data. |
Output
JSON
json- The original input data item if it passes validation, or an error object containing validation error messages and details if validation fails.
Dependencies
- ajv (Another JSON Schema Validator) library for schema validation
Troubleshooting
- Common issues include invalid JSON Schema syntax or structure, which will cause the node to throw errors during compilation of the schema.
- If input data does not conform to the schema, the node throws a validation error unless 'Continue On Fail' is enabled, in which case error details are output alongside the item.
- Errors related to schema compilation or validation will include detailed messages from the AJV library to help identify the problem.