Skip to main content

A single file schema validator for dictionaries.

Project description

Schemander

As in Schema + Commander...

... it took me a while to connect the name with the "Fantastic Beasts and Where to Find Them" (2016) film, main character.

This module aims to simplify the way we handle JSON Schemas in Python, leveraging type annotations.

Install

pip install schemander

When working with JSON is common to have situations in which string values are "blest" with extra meaning or behaviour such as dates, datetimes, email, phone numbers, amoung others. This module solves this by defining a class that we can extend called InternalObjectTypeString, which attempt to convert the value of the string in to an object while preserving the string version as a main display value, exposing the converted object via an attribute named value.

Moreover when converting a JSON in to a data structure, we usually have to pass through a dictionary, and then "cast" in to the desired representation we desire. For this we define a Schema from which we need to extend in order to define a schema where you will define attributes with a type-hint, int, float, str, bool, typing.List with a given type to have a homogeneous array (heterogeneous, are not supported) or a class that will take the field value as only argument for construction, such as UUID, or some of the InternalObjectTypeString or RegexValidatedString.

An example on how to write for a user could be found at ./example.py.

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

schemander-0.0.7.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schemander-0.0.7-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file schemander-0.0.7.tar.gz.

File metadata

  • Download URL: schemander-0.0.7.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for schemander-0.0.7.tar.gz
Algorithm Hash digest
SHA256 7fec9e7cf4dda67317b6bc965ceeae7bb3b2275f5811c91a50d404d9844e6e0f
MD5 681b2f6c93423ad75d1d2187d9f58b35
BLAKE2b-256 2cbbcab1b5cd6794ae9be917b88d3b028f0de3929e130ce6975aa7ea0ea97c3a

See more details on using hashes here.

File details

Details for the file schemander-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: schemander-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for schemander-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1e9bfe2a8f3827d477069ae423e6bb79f22f7333adab32776c3c89d38efab7bb
MD5 9aba408b11e2ba85fafc7ea562f342ed
BLAKE2b-256 f319b2bb11d22cb7596eac48990021a56e2fba4cabacd36ea0d034c2b1bff8a8

See more details on using hashes here.

Supported by

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