MockForge is a flexible mock data generation API that helps developers create realistic test data using Java Faker field paths.
It provides a simple REST endpoint to generate customized JSON data for development and testing purposes.
- Dynamic JSON data generation based on field paths
- Support for nested object structures
- Configurable number of mock objects
- OpenAPI/Swagger documentation
- Docker support
- Simple REST API interface
- Java 17 or higher
- Maven 3.6+
- Docker (optional)
- Clone the repository:
git clone https://github.com/yourusername/mockforge.git
cd mockforge
- Build the project:
./mvnw clean install
- Run the application:
./mvnw spring-boot:run
The API will be available at http://localhost:8080/
- Build the Docker image:
docker build -t mockforge .
- Run the container:
docker run -p 8080:8080 mockforge
Generate Mock Data
GET /mock?fields=name.firstName,address.city,phone.cellPhone&count=2
Parameters:
fields
: Comma-separated list of Java Faker field pathscount
(optional) : Number of Objects to generate (default : 1)
Example Response:
[
{
"name": {
"firstName": "John"
},
"address": {
"city": "New York"
},
"phone": {
"cellPhone": "1-234-567-8900"
}
},
{
"name": {
"firstName": "Jane"
},
"address": {
"city": "Los Angeles"
},
"phone": {
"cellPhone": "1-234-567-8901"
}
}
]
Available Field Paths
The API supports all field paths available in Java Faker. Some commonly used paths include:
name.firstName
name.lastName
address.streetAddress
address.city
address.country
internet.email
phone.cellPhone
company.name
commerce.price
For a complete list of available fields, visit the Java Faker Documentation
Access the OpenAPI/Swagger documentation at:
http://localhost:8080/swagger-ui.html
The project includes a render.yml configuration for deployment on Render.
- Fork this repository
- Connect your fork to Render
- Create a new Web Service using the repository
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.