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.schemas.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.1.1.dev2.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

justobjects-0.1.1.dev2-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file justobjects-0.1.1.dev2.tar.gz.

File metadata

  • Download URL: justobjects-0.1.1.dev2.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for justobjects-0.1.1.dev2.tar.gz
Algorithm Hash digest
SHA256 7f50c76d0cc3eb415eac191ecff86cdada5db7e53024d6e391464efd8c598ac6
MD5 a500536c8a569bce51b44f672a25cafc
BLAKE2b-256 66ce1a68665a1c2d094d46a8315a471159545a27c8302690ae6ccc3fd302f067

See more details on using hashes here.

File details

Details for the file justobjects-0.1.1.dev2-py3-none-any.whl.

File metadata

  • Download URL: justobjects-0.1.1.dev2-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for justobjects-0.1.1.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 3146c4c02f1be6df7805d9a7e421981ff1986f684ea40c1383cb05677b9080a3
MD5 2ac6ed18ea93bb3a175c5e23cd6da1e5
BLAKE2b-256 b69d13fe2d3d82f2c6b02279833fa96c48cafcdfa6a54107254c7a7e15b0f049

See more details on using hashes here.

Supported by

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