Skip to main content

Creates fake JSON files from a JSON schema

Project description

jsf

documentation PyPI Latest Release License Code style: black

What is it

This repository is a Python port of json-schema-faker with some minor differences in implementation.

Use jsf along with fake generators to provide consistent and meaningful fake data for your system.

Main Features

  • Provides out of the box data generation from any JSON schema
  • Extendable custom data providers using any lambda functions
  • Multi level state for dependant data (eg multiple objects sharing value, such as children with same surname)
  • Inbuilt validation of fake JSON produced

Where to get it

The source code is currently hosted on GitHub at: https://github.com/ghandic/jsf

Binary installers for the latest released version are available at the Python package index

pip install jsf

Dependencies

  • faker - For fake data provisioning
  • rstr - For building strings from regex patterns
  • smart_open - For opening external $ref
  • jsonschema - For schema/instance validation
  • typer - For neat commandline applications
  • dataclasses_json - For easy dataclass serialization

License

Usage

As a program

  • pip install jsf
  • In your code where you need to you will be using jsf you can refer to below script as reference:
from jsf import JSF

faker = JSF.from_json("demo-schema.json")
fake_json = faker.generate()

From the commandline

Raw install

jsf --schema src/tests/data/custom.json --instance wow.json

Docker

docker build . -t challisa/jsf
docker run -v $PWD:/data challisa/jsf jsf --schema /data/src/tests/data/custom.json --instance /data/wow.json

Contributing to jsf

To contribute to jsf, follow these steps:

  1. Fork the repository
  2. Create a branch in your own fork: git checkout -b <branch_name>.
  3. Make your changes and commit them: git commit -m '<commit_message>'
  4. Push to the original branch: git push origin <project_name>/<location>
  5. Create the pull request back to our fork.

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

jsf-0.1.0.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

jsf-0.1.0-py3-none-any.whl (12.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