All Projects → jacksmith15 → statham-schema

jacksmith15 / statham-schema

Licence: MIT License
Statham is a Python Model Parsing Library for JSON Schema.

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to statham-schema

Staticjson
Fast, direct and static typed parsing of JSON with C++
Stars: ✭ 177 (+742.86%)
Mutual labels:  parsing, json-schema
Firely Net Sdk
The official Firely .NET SDK for HL7 FHIR
Stars: ✭ 560 (+2566.67%)
Mutual labels:  serialization, parsing
ruby-marshal
Haskell library to parse a subset of Ruby objects serialised with Marshal.dump
Stars: ✭ 30 (+42.86%)
Mutual labels:  serialization, parsing
modelina
Library for generating data models based on inputs such as AsyncAPI, OpenAPI, or JSON Schema documents.
Stars: ✭ 55 (+161.9%)
Mutual labels:  json-schema, model
sexp-grammar
Invertible parsing for S-expressions
Stars: ✭ 28 (+33.33%)
Mutual labels:  serialization, parsing
Pydantic
Data parsing and validation using Python type hints
Stars: ✭ 8,362 (+39719.05%)
Mutual labels:  parsing, json-schema
Jsoniter Scala
Scala macros for compile-time generation of safe and ultra-fast JSON codecs
Stars: ✭ 410 (+1852.38%)
Mutual labels:  serialization, parsing
json2object
Type safe Haxe/JSON (de)serializer
Stars: ✭ 54 (+157.14%)
Mutual labels:  parsing, json-schema
Awesome Python Models
A curated list of awesome Python libraries, which implement models, schemas, serializers/deserializers, ODM's/ORM's, Active Records or similar patterns.
Stars: ✭ 124 (+490.48%)
Mutual labels:  serialization, model
Mini Yaml
Single header YAML 1.0 C++11 serializer/deserializer.
Stars: ✭ 79 (+276.19%)
Mutual labels:  serialization, parsing
dataconf
Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support.
Stars: ✭ 40 (+90.48%)
Mutual labels:  serialization, parsing
php-json-schema-model-generator
Creates (immutable) PHP model classes from JSON-Schema files including all validation rules as PHP code
Stars: ✭ 36 (+71.43%)
Mutual labels:  json-schema, model
Core
🌎 Utility package containing tools for byte manipulation, Codable, OS APIs, and debugging.
Stars: ✭ 62 (+195.24%)
Mutual labels:  serialization, parsing
wasmbin
A self-generating WebAssembly parser & serializer in Rust.
Stars: ✭ 40 (+90.48%)
Mutual labels:  serialization, parsing
Maat
Validation and transformation library powered by deductive ascending parser. Made to be extended for any kind of project.
Stars: ✭ 27 (+28.57%)
Mutual labels:  serialization, json-schema
php-binary
A PHP library for parsing structured binary streams.
Stars: ✭ 30 (+42.86%)
Mutual labels:  parsing
pyvaru
Rule based data validation library for python 3.
Stars: ✭ 17 (-19.05%)
Mutual labels:  model
racket-bitsyntax
Erlang-style binaries/bitstrings for Racket
Stars: ✭ 29 (+38.1%)
Mutual labels:  parsing
Ohm-S
A Squeak/Smalltalk implementation of the metaprogramming framework Ohm.
Stars: ✭ 18 (-14.29%)
Mutual labels:  parsing
ty
Here is a schema checker which can return well typed results. Tell your friends!
Stars: ✭ 21 (+0%)
Mutual labels:  json-schema

Build Status Documentation Status

Statham

statham is a Python Model Parsing Library for JSON Schema. Read the documentation.

This project includes tools for writing and generating extensible Python classes based on JSON Schema documents.

Example Model Definition

statham can be used to write JSON Schema documents and their corresponding application-level models in one go:

from typing import List

from statham.schema.elements import Array, Integer, Object, String
from statham.schema.property import Property


class Choice(Object):
    choice_text: str = Property(String(maxLength=200), required=True)
    votes: int = Property(Integer(default=0))


class Poll(Object):
    question: str = Property(String(), required=True)
    choices: List[Choice] = Property(Array(Choice), required=True)

Generating python classes

Alternatively, Python models may be generated automatically from an existing schema:

statham --input http://example.com/schema.json

Command-line arguments

Required arguments:
  --input INPUT    Specify the path to the JSON Schema to be generated.

                   If the target schema is not at the root of a document, specify the
                   JSON Pointer in the same format as a JSON Schema `$ref`, e.g.
                   `--input path/to/document.json#/definitions/schema`


Optional arguments:
  --output OUTPUT  Output directory or file in which to write the output.

                   If the provided path is a directory, the command will derive the name
                   from the input argument. If not passed, the command will write to
                   stdout.

  -h, --help       Display this help message and exit.

Installation

This project requires Python 3.6+ and may be installed using pip:

pip install statham-schema

Compatibility

See Compatibility for information regarding the currently supported JSON Schema draft and exceptions.

Development

  1. Clone the repository: git clone [email protected]:jacksmith15/statham-schema.git && cd statham-schema
  2. Initialise git submodules: git submodule update --init --recursive
  3. Install the requirements: pip install -r requirements.txt -r requirements-test.txt
  4. Run pre-commit install
  5. Run the tests: bash run_test.sh -c -a

This project uses the following QA tools:

  • PyTest - for running unit tests.
  • PyLint - for enforcing code style.
  • MyPy - for static type checking.
  • Travis CI - for continuous integration.
  • Black - for uniform code formatting.

Documentation is written using Sphinx.

License

This project is distributed under the MIT license.

statham

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].