Skip to main content

Simple data object (de)serialization and validation

Project description

PyPi version PyPi versions CI status Documentation Status

Simple python data objects management and validation based on standard jsonschema concepts. Project requires python3.6+ and allows users define how data objects should look and relate with other data objects. Supports python3.6+ typing annotations and customs attributes for more complex relationships.

Objectives

  1. Define and demarcate data objects with just python annotations

  2. Define constraints in simple jsonschema compliant manner

  3. Validate data objects using standard jsonschema validators

  4. Express complete jsonschema as simple data objects (its just objects)

Similar Projects

Install

install from pip

$ pip install justobjects

install from source

$ pip install git+https://github.com/kulgan/justobjects@<version>#egg=justobjects

Usage Example

import json
import justobjects as jo


@jo.data(typed=True)
class Model:
    a: int
    b: float
    c: str


# display schema
print(json.dumps(jo.show_schema(Model), indent=2))


try:
    # fails validation
    jo.validate(Model(a=3.1415, b=2.72, c="123"))
except jo.ValidationException as err:
    print(err.errors)

Contributing

The fastest way to get feedback on contributions/bugs is create a issues

Running Tests

The project makes use of tox to run tests and other common tasks

$ tox -e py36

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

justobjects-0.3.0.tar.gz (32.3 kB view hashes)

Uploaded Source

Built Distribution

justobjects-0.3.0-py3-none-any.whl (20.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page