Metadata-Version: 2.1
Name: validrequest
Version: 0.0.2
Summary: This is a request handler validation tool for RESTful API endpoints.
Home-page: https://github.com/ableinc/validrequest
Author: AbleInc - Jaylen Douglas
Author-email: douglas.jaylen@gmail.com
License: GNU General Public License v3 (GPLv3)
Keywords: validation tool,validation,api,restful,endpoints,ableinc
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown

# Validator

This is a request handler validation tool for RESTful API endpoints.

## How To Use

```python
from validator import validator, ValidationError

def request_handler(req, res, next):
    # If you're familiar with Express.js req, res, next should be understood
    validation_rules = get_validation_rules()
    request_parameters = req.query
    validation_rules = {
        "q": "string|required|max:100",
        "timestamp": "string|sometimes|max:30",
        "names": "list|required|min:3",
        "code": "integer|required|"
    }
    try:
        validator(validation_rules, request_parameters)
    except ValidationError:
        return next({ "message": "The request parameters are not valid."})
    res.json({"message": "Validation successful."})
```
Refer to the ```demo.py``` file for further implementations.

## How to Install


```bash
python -m pip install validrequest
```
or

```bash
python -m pip install git+https://github.com/ableinc/validator.git
```

## Contributions

This library was designed and inspired by [Jacob Lucas](https://gitlab.com/Jlucas87). Validator is a python rewrite of the original nodeJS library.
