Validate input and output
How to automatically validate your input and ouput with JSON schema
Nango automatically validates your integration inputs & outputs. It also offers ways to further customize data validation in code. The guide will walk you through each approach.
Automatic validation
The validation is available during development and production, and does not require any configuration from you:
- CLI: Dry Run validation errors are logged and will halt execution when using
--validation
command option - Production: Validation errors are logged but do not halt execution
Available schema files
When you use Nango CLI, it automatically generates two schema files in the .nango
folder:
schema.ts
a TypeScript file that contains all your models.schema.json
a JSON Schema file that is used for automatic data validation.
These files can be versioned and integrated into your own codebase, ensuring consistency and reliability across different environments.
Custom Validation
For more advanced use cases, you can generate your own validation schemas using the available files with the tool of your choice.
To create zod
schemas you can use ts-to-zod
npm package. This tool converts TypeScript definitions into Zod schemas, which can be used for runtime validation in your own Typescript codebase.
You can use zod models in your scripts too
Using schema.json
in your codebase
JSON Schema is supported in most of the main software languages, here is a non-exhaustive list of how you can directly use this file to validate the records you receive from Nango.
Was this page helpful?