Metadata-Version: 1.1
Name: dataclasses-jsonschema
Version: 1.5.2
Summary: JSON schema generation from dataclasses
Home-page: https://github.com/s-knibbs/dataclasses-jsonschema
Author: Simon Knibbs
Author-email: simon.knibbs@gmail.com
License: MIT
Description-Content-Type: UNKNOWN
Description: Dataclasses JSON Schema
        =======================
        
        .. image:: https://travis-ci.org/s-knibbs/dataclasses-jsonschema.svg?branch=master
            :target: https://travis-ci.org/s-knibbs/dataclasses-jsonschema
        
        .. image:: https://badge.fury.io/py/dataclasses-jsonschema.svg
            :target: https://badge.fury.io/py/dataclasses-jsonschema
        
        JSON schema generation from python 3.7 dataclasses. Python 3.6 is supported through the dataclasses backport.
        Also provides serialisation to and from JSON data with JSON schema validation.
        
        Examples
        --------
        
        .. code:: python
        
            from dataclasses import dataclass
        
            from dataclasses_jsonschema import JsonSchemaMixin
        
        
            @dataclass
            class Point(JsonSchemaMixin):
                x: float
                y: float
        
        
        Generate the schema:
        
        .. code:: python
        
            >>> pprint(Point.json_schema())
            {
                'description': 'Point(x:float, y:float)',
                'type': 'object',
                'properties': {
                    'x': {'format': 'float', 'type': 'number'},
                    'y': {'format': 'float', 'type': 'number'}
                },
                'required': ['x', 'y']
            }
        
        
        Deserialise data:
        
        .. code:: python
        
            >>> Point.from_dict({'x': 3.14, 'y': 1.5})
            Point(x=3.14, y=1.5)
            >>> Point.from_dict({'x': 3.14, y: 'wrong'})
            jsonschema.exceptions.ValidationError: 'wrong' is not of type 'number'
        
        For more examples `see the tests <https://github.com/s-knibbs/dataclasses-jsonschema/blob/master/tests/conftest.py>`_
        
        TODO
        ----
        
        * Support type Union using 'oneOf'
        
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries
