Metadata-Version: 2.1
Name: json-pattern-validator
Version: 0.1
Summary: Utility for evaluate matching json with a template
Home-page: https://github.com/dmalisani/json_pattern_validator
Author: Daniel Malisani
Author-email: dmalisani@gmail.com
License: UNKNOWN
Keywords: json,schema,validation,validator,payload
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Description-Content-Type: text/markdown

Validation schema based of a json string or a dict

Schema:
=======
* You must define a dict which will match with a json/dict under test
* add **!** at begin fo key for to indicate a required field
* In value of that key you will need specify a validator for such field
* That validator have to be a valid default validator or you can add your own
```
    EXAMPLE_SCHEMA = {
        "!version": "string",
        "!email": "email",
        "!data": {
            "!Id": "number",
            "title": "string"  # optional
            },
        }
 ```


Usage:
======
    Example:
```
    ok_json = {
        "version": "1.0.1a",
        "email": "test@test.com",
        "data": {
            "Id": 231,
            "title": "description"
        }
    }
    e = JSONEvaluator()
    e.set_schema(EXAMPLE_SCHEMA)
    e.evaluate(ok_json)
    if e.ok:
       print("Dict validate")
    else:
       print("errors found:")
       print(e.errors)

```


