Metadata-Version: 1.1
Name: json-payload-validator
Version: 0.1.0
Summary: JSON validator package based on jsonschema that returns nicer validation errors for end users
Home-page: https://github.com/thiagomarini/json-payload-validator
Author: Thiago Marini
Author-email: UNKNOWN
License: MIT
Description: Json Payload Validator
        ======================
        
        |CircleCI| |PyPI version shields.io| |PyPI license| |PyPI pyversions|
        
        .. |CircleCI| image:: https://circleci.com/gh/thiagomarini/json-payload-validator.svg?style=svg
            :target: https://circleci.com/gh/thiagomarini/json-payload-validator
        
        .. |PyPI version shields.io| image:: https://img.shields.io/pypi/v/json_payload_validator.svg
           :target: https://pypi.python.org/pypi/json_payload_validator/
        
        .. |PyPI license| image:: https://img.shields.io/pypi/l/json_payload_validator.svg
           :target: https://pypi.python.org/pypi/json_payload_validator/
        
        .. |PyPI pyversions| image:: https://img.shields.io/pypi/pyversions/json_payload_validator.svg
           :target: https://pypi.python.org/pypi/json_payload_validator/
        
        Little Python package that formats validation error messages from `jsonschema
        <https://pypi.python.org/pypi/jsonschema>`_.
        You should use this package if you want a stand alone json validator decoupled from any framework.
        
        Reason of being
        ---------------
        
        jsonschema is really cool but its validation error messages suck as they're meant for developers, not end users.
        So if you have an API that uses jsonschema to validate json payloads and want to return nicer error messages to your
        end users you can use this package :)
        
        How it works
        ------------
        
        3 simple rules:
        
        - If you don't send a required property in the payload you'll get the message ``'foo' is a required property``.
        - If validation fails the validation rule will be returned ``Validation of property 'name' failed: {'minLength': 2, 'type': 'string', 'maxLength': 50}``.
        - If you add ``message`` property in your validation rule its value will be returned instead of the rule ``Validation of property 'foo' failed: Custom error message``.
        
        Usage
        -----
        
        To use, simply do:
        
        .. code-block:: python
        
            from json_payload_validator import validate
        
            schema = {
                'type': 'object',
                'properties': {
                    'name': {'type': 'string', 'minLength': 2, 'maxLength': 50},
                },
                'required': [
                    'name'
                ]
            }
        
            # example of validation
            payload = {'name': 'John Maus'}
        
            error = validate(payload, schema)
        
            if error is None:
                print('Validation passed :-)')
            else:
                print(error)
                # Validation of property 'name' failed: {'minLength': 2, 'type': 'string', 'maxLength': 50}
        
Keywords: json schema payload validation
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
