Creates fake JSON files from a JSON schema
Project description
jsf
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
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:
- Fork the repository
- Create a branch in your own fork:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
- Push to the original branch:
git push origin <project_name>/<location>
- Create the pull request back to our fork.
Project details
Release history Release notifications | RSS feed
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.1.tar.gz
(10.5 kB
view hashes)
Built Distribution
jsf-0.1.1-py3-none-any.whl
(13.0 kB
view hashes)