> For the complete documentation index, see [llms.txt](https://iamthilina.gitbook.io/xpress-req-validator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://iamthilina.gitbook.io/xpress-req-validator/get-started/knowledge/joi-specs.md).

# Joi Specs

`xpress-req-validator` relies on `Joi` to do all validation tasks. You can validate following sources of a request (all are optional)

* header
* path
* query
* body

You must define Joi specs separately and assign them to each corresponding source.

{% code title="example" %}

```javascript
'/user/:id': {
    header: USER_HEADER_SPEC,
    path: USER_PATH_SPEC,
    query: USER_QUERY_SPEC,
    body: USER_BODY_SPEC,
}
```

{% endcode %}

`xpress-req-validator` validates only the specified sources of request. Any undefined source will not be validated by the middleware

##
