Skip to main content

district42 to JSON-Schema translator and vise versa

Project description

SchemaMaximal

district42 schemas โ‡† JSON Schema

Installation

pip3 install schemax

Usage

>>> import schemax
>>> from district42 import schema
>>> ExampleSchema = schema.str.len(1, 10)
>>> schemax.to_json_schema(ExampleSchema)
{'type': 'string', 'minLength': 1, 'maxLength': 10}

Also, you could use schemax to translate from JSON-Schema to d42 and generate tests interfaces (in future releases) via command line:

$ python3 -m schemax translate schema.json
Translation from JSON-Schema to d42-schema for schema.json:
schema.dict({
    'number': schema.int.min(1),
    optional('street_name'): schema.str,
    ...: ...
})

schema.json:

{
  "type": "object",
  "properties": {
    "number": { "type": "integer", "minimum": 1 },
    "street_name": { "type": "string" }
  },
  "required": ["number"],
  "additionalProperties": true
}

Supported d42 -> JSON Schema types and features

(โœ… - done; ๐Ÿ”ง - planned support; โŒ - unsupportable)

Supported JSON Schema -> d42 types and features

(โœ… - done; ๐Ÿ”ง - planned support; โŒ - unsupportable)

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

schemax-0.1.0.tar.gz (13.7 kB view hashes)

Uploaded Source

Built Distribution

schemax-0.1.0-py3-none-any.whl (11.6 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