Metadata-Version: 2.1
Name: sonic182-json-validator
Version: 1.0.2
Summary: A custom json validator
Home-page: https://github.com/sonic182/json_validator
Author: Johanderson Mogollon
Author-email: johanderson@mogollon.com.ve
License: MIT
Keywords: json validator dictionary
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Provides-Extra: test
Provides-Extra: dev
Provides-Extra: dev
Requires-Dist: astroid (==1.6.0); extra == 'dev'
Requires-Dist: autopep8 (==1.3.3); extra == 'dev'
Requires-Dist: docstrings (==1.3.0); extra == 'dev'
Requires-Dist: polyfill (==1.0.2); extra == 'dev'
Requires-Dist: flake8 (==3.5.0); extra == 'dev'
Requires-Dist: isort (==4.2.15); extra == 'dev'
Requires-Dist: proxy (==1.3.1); extra == 'dev'
Requires-Dist: mccabe (==0.6.1); extra == 'dev'
Requires-Dist: pycodestyle (==2.3.1); extra == 'dev'
Requires-Dist: pydocstyle (==2.1.1); extra == 'dev'
Requires-Dist: pyflakes (==1.6.0); extra == 'dev'
Requires-Dist: pylint (==1.8.1); extra == 'dev'
Requires-Dist: six (==1.11.0); extra == 'dev'
Requires-Dist: snowballstemmer (==1.2.1); extra == 'dev'
Requires-Dist: wrapt (==1.10.11); extra == 'dev'
Provides-Extra: test
Requires-Dist: attrs (==17.4.0); extra == 'test'
Requires-Dist: coverage (==4.4.2); extra == 'test'
Requires-Dist: gprof2dot (==2017.9.19); extra == 'test'
Requires-Dist: mock (==2.0.0); extra == 'test'
Requires-Dist: pbr (==3.1.1); extra == 'test'
Requires-Dist: pluggy (==0.6.0); extra == 'test'
Requires-Dist: py (==1.5.2); extra == 'test'
Requires-Dist: cov (==2.5.1); extra == 'test'
Requires-Dist: mock (==1.6.3); extra == 'test'
Requires-Dist: profiling (==1.2.11); extra == 'test'
Requires-Dist: pytest (==3.3.2); extra == 'test'
Requires-Dist: six (==1.11.0); extra == 'test'

|Build Status| |Coverage Status| |PyPI version|

Json Validator
==============

A json validator focused on speed.

-  Not recursion
-  Works with Python 2.7.x, 3.4.x, 3.5.x, 3.6. It may work with 3.7.X
-  Constrains based on python types.
-  Lazy Validation
-  Constrain definitions with python types

.. code:: python

    from json_validator import JsonValidator

    constrain = {
          'string': {},  # str by default.
          'integer': {'type': int},
          'float': {'type': float},
          'boolean': {'type': bool},
          'json': {'type': dict },
          'list': {'type': list},
          'extra_1': {},
          'extra_2': {},
      }
      json = {
          'string': 'foo',
          'integer': 42,
          'float': 1.10,
          'boolean': True
      }
      # accepts json string, dict and lists.
      res, err = JsonValidator(constrain).validate(json)
      res == json  # => True
      err == {'extra_1': 'Missing field', 'extra_2': 'Missing field'}  # => True

See all rules for fields `here`_.

Install
=======

.. code:: bash

    pip install sonic182_json_validator

Development
===========

Install packages with pip-tools:

.. code:: bash

    pip install pip-tools
    pip-compile
    pip-compile dev-requirements.in
    pip-sync requirements.txt dev-requirements.txt

TODO
====

-  Documentation about rules.

Contribute
==========

1. Fork
2. create a branch ``feature/your_feature``
3. commit - push - pull request

Thanks :)

.. _here: https://github.com/sonic182/json_validator/blob/master/tests/test_validator.py

.. |Build Status| image:: https://travis-ci.org/sonic182/json_validator.svg?branch=master
   :target: https://travis-ci.org/sonic182/json_validator
.. |Coverage Status| image:: https://coveralls.io/repos/github/sonic182/json_validator/badge.svg?branch=master
   :target: https://coveralls.io/github/sonic182/json_validator?branch=master
.. |PyPI version| image:: https://badge.fury.io/py/sonic182_json_validator.svg
   :target: https://badge.fury.io/py/sonic182_json_validator

