Skip to main content

JSON generation based on schema.

Project description

DJG

DJG is a simple library and cli tool generating JSON objects based on a given schema.

DJG is in very early development.

Currently supported features:

  • number
  • string
  • array
  • enum & const for each type

Installation

Install via pip

$ pip install djg

Usage

As Python module

from djg import gen_from_schema
import json

schema = {
    "type": "object",
    "properties": {
        "ProductIdentifier": {
            "type": "object",
            "properties": {
                "Name": {"type": "string", "pattern": "[a-zA-Z]{5,10}"},
                "Uid": {"type": "number", "minimum": 1000, "maximum": 100000},
            },
        },
        "ProductQuantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
        },
    },
}

json_object = gen_from_schema(schema)

CLI

djg --help

usage: djg.py [-h] -s SCHEMA_FILE [-o FILE]

djg - create random JSON objects based on a given schema.

options:
  -h, --help            show this help message and exit
  -s SCHEMA_FILE, --schema SCHEMA_FILE
                        JSON Schema loaction
  -o FILE, --output FILE
                        JSON output location - default is stdout

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

djg-0.1.1.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

djg-0.1.1-py3-none-any.whl (4.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