# Validation

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.

## API Specs and Database

**JSON Schema**, used within fastify via AJV, makes it easy to enforce how your api should behave before, during, and after processing.&#x20;

This, along with the fast performance brought by fastify, makes your system more resilient when dealing with APIs.

You can see the libraries below

{% embed url="<https://ajv.js.org/>" %}

{% embed url="<https://json-schema.org/>" %}

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.

[Using Validations →](https://docs.novel.dev/guides/knowledge-base/database/using-validations)

[Securing an Endpoint →](https://docs.novel.dev/guides/knowledge-base/novel-server/securing-an-endpoint)

For client-side validation. refer to [Validation](/novel-web/validation.md).

## Changelog

* 2024-12-20 - Initial Documentation


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.novel.dev/novel-server/validation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
