Skip to main content

Creates fake JSON files from a JSON schema

Project description

jsf

coverage 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
  • pydantic - For easy serialization and validation

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

Mkdocs

The documentation for this project is written in Markdown and built using mkdocs, the easiest way to get the docs up for development is to run it in Docker

docker-compose up mkdocs-jsf

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.3.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

jsf-0.3.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file jsf-0.3.1.tar.gz.

File metadata

  • Download URL: jsf-0.3.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for jsf-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e75a2396258b1e2b912184bcb60909fd220d480adae5e5dce298d749b68bc76b
MD5 09d877be984e1b24834b0ff41a0b9537
BLAKE2b-256 d7ca09dbf67139becacb3f71d8945165615e5919537c47b533b4e3a27b1ed647

See more details on using hashes here.

File details

Details for the file jsf-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: jsf-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for jsf-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6451b6a3acb06ad1bbb9d3c1b78c5708e58d8e9538ab09188842c2d5a8409ee6
MD5 c03656337d64c606bdcc52d859cf40d1
BLAKE2b-256 05e2e3c3a0b2927e874dc28292c436a6b540de4f5bd5a8b1c9fb1b7c48a185aa

See more details on using hashes here.

Supported by

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