A CLI tool to generate mock JSON data from schemas, with optional API posting and file saving.
Project description
Mock Data Forge (CLI)
Mock Data Forge is a powerful command-line tool to generate mock JSON data based on custom schemas. It supports saving to files, sending data to APIs, and enforcing constraints for realistic and structured test data.
Features
- Generate Mock Data: Quickly produce JSON objects based on your schema.
- Supports Multiple Data Types:
- Primitive Data Types:
string,integer,float,boolean - Semantic Data Types:
name,email,phone,date - File Data Types:
image_url,file_url - Complex Data Types:
object,array
- Primitive Data Types:
- Constraints & Logic:
- Range: Set minimum and maximum for numbers.
- Choice/Enum: Pick values from a specific list.
- Regex: Generated strings match a regex pattern.
- Automated API Support: If you provide an API endpoint, the generator will automatically send the generated data.
Quick Start
Install the CLI via pip:
pip install mock-data-forge
Usage
Generate data with default schema
mock-data
Specify a custom schema file
mock-data -s path/to/schema.json
Generate multiple objects
mock-data -c 10
Save output to a file
mock-data -S output.json
Send data to API endpoints
mock-data -a http://example.com/api1 http://example.com/api2
Combine options
mock-data -s schema.json -c 5 -S output.json -a http://example.com/api -n
- -n / --no-print prevents output from being printed to the console.
Options:
-s, --schema : Path to schema JSON file (default: example-schema.json)
-c, --count : Number of objects to generate (default: 1)
-a, --api : API endpoints to send the generated data
-S, --save : Save output to a file (default: data-save.json)
-n, --no-print : Do not print generated data to stdout
Example Schema
{
"name": { "type": "name" },
"email": { "type": "email" },
"age": { "type": "integer", "min": 18, "max": 65 },
"tags": { "type": "array", "length": 3, "items": { "type": "string", "enum": ["red","green","blue"] } }
}
Repository Structure
mock-data-forge/
├── mock_data_forge/
│ ├── __init__.py
│ ├── __main__.py
│ └── generator.py
├── README.md
├── example-schema.json
├── pyproject.toml
├── LICENSE
└── MANIFEST.in
Logging
Mock Data Forge uses Python’s built-in logging module. By default, it logs info and warning messages to the console.
GUI Version
- If you prefer a graphical interface, you can check out the GUI version of Mock Data Forge:
Mock Data Forge GUI + CLI on GitHub - Clone the repo and follow its README to set up the GUI.
License
MIT License © 2025 HattoriMan
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mock_data_forge-0.1.1.tar.gz.
File metadata
- Download URL: mock_data_forge-0.1.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ba6bcdd53fcdb885e42355c778fb611b37389ad4435e2e8c928c2b0f3f95682
|
|
| MD5 |
1b5ab42db481069bae2dc048570a829b
|
|
| BLAKE2b-256 |
0d8dfe1ade02b6d5a2825b654b4671653cc7cf5bb2d57ba80303e09598de83c5
|
File details
Details for the file mock_data_forge-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mock_data_forge-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
120dc956cb6838e71d5227cf54be01dfd31b67c2195af59e01d1683868e54d75
|
|
| MD5 |
4b2538f05b31ff37b351363306293c48
|
|
| BLAKE2b-256 |
52253a5622e8f75d965277978f834609588def442045bf6bd5dfafc39327e989
|