Validation
Last updated
Was this helpful?
Last updated
Was this helpful?
Novel makes use of 2 validation mechanisms: JSON Schema and Zod. both serve specific purpose, for shaping requests and responses and for verifying input.
Although these are optional, it is recommended that you build your system utilizing these tools as much as possible.
JSON Schema, used within fastify via AJV, makes it easy to enforce how your api should behave before, during, and after processing.
This, along with the fast performance brought by fastify, makes your system more resilient when dealing with APIs.
You can see the libraries below
The standards above makes it easier to generate clients via OpenAPI/Swagger. These definitions are generated and used internally by the Novel Web client to easily expose routes as an RPC and provide an easy development experience.
JSON Schema is recommended to be used for API Request/Response shapes. Client-side validation should use zod instead.
For client-side validation. refer to Validation.
2024-12-20 - Initial Documentation