<commit_before># express-joi-validation

![TravisCI](https://travis-ci.org/evanshortiss/express-joi-validation.svg)
[![npm version](https://badge.fury.io/js/express-joi-validation.svg)](https://badge.fury.io/js/express-joi-validation)
[![Coverage Status](https://coveralls.io/repos/github/evanshortiss/express-joi-validation/badge.svg?branch=master)](https://coveralls.io/github/evanshortiss/express-joi-validation?branch=master)
[![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)

A middleware for validating express inputs using Joi schemas. Fills some of the
voids I found that other Joi middleware miss such as:

* Allow the developers to easily specify the order in which request inputs are
validated.
* Replaces the incoming `req.body` and others with converted Joi values. The
same applies for headers, query, and params, but...
* Retains the original `req.body` inside a new property named `req.originalBody`
. The same applies for headers, query, and params using the `original` prefix,
e.g `req.originalQuery` will contain the `req.query` as it looked *before*
validation.
* Passes sensible default options to Joi for headers, params, query, and body.
These are detailed below.<commit_msg>chore: add reademe info badges<commit_after># express-joi-validation

![TravisCI](https://travis-ci.org/evanshortiss/express-joi-validation.svg)
[![Coverage Status](https://coveralls.io/repos/github/evanshortiss/express-joi-validation/badge.svg?branch=master)](https://coveralls.io/github/evanshortiss/express-joi-validation?branch=master)
[![npm version](https://badge.fury.io/js/express-joi-validation.svg)](https://www.npmjs.com/package/express-joi-validation)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-blue.svg)](http://www.typescriptlang.org/)
[![npm downloads](https://img.shields.io/npm/dm/express-joi-validation.svg?style=flat)](https://www.npmjs.com/package/express-joi-validation)

A middleware for validating express inputs using Joi schemas. Fills some of the
voids I found that other Joi middleware miss such as:

* Allow the developers to easily specify the order in which request inputs are
validated.
* Replaces the incoming `req.body` and others with converted Joi values. The
same applies for headers, query, and params, but...
* Retains the original `req.body` inside a new property named `req.originalBody`
. The same applies for headers, query, and params using the `original` prefix,
e.g `req.originalQuery` will contain the `req.query` as it looked *before*
validation.
* Passes sensible default options to Joi for headers, params, query, and body.
These are detailed below.
{'fraction_non_alphanumeric': 0.12666666666666668, 'fraction_numerical': 0.0022222222222222222, 'mean_word_length': 5.430952380952381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 15, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1234720', 'n_tokens_mistral': 854, 'n_tokens_neox': 831, 'n_words': 231}