55 lines
1.1 KiB
Markdown
55 lines
1.1 KiB
Markdown
# MockAPI - OpenAPI Mock Server Generator
|
|
|
|
A CLI tool that generates a fully functional mock API server from OpenAPI 3.x specifications.
|
|
|
|
## Features
|
|
|
|
- Generate mock server from OpenAPI 3.x specs
|
|
- Configurable response delays and error simulation
|
|
- Random realistic test data generation from schemas
|
|
- Request validation against OpenAPI spec
|
|
- Hot-reload on spec changes
|
|
- Built-in random data generators for common types
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
pip install -e .[dev]
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Validate an OpenAPI spec
|
|
mockapi validate openapi.yaml
|
|
|
|
# Start a mock server
|
|
mockapi start openapi.yaml
|
|
|
|
# Show configuration
|
|
mockapi show-config
|
|
```
|
|
|
|
## CLI Commands
|
|
|
|
- `validate` - Validate an OpenAPI specification file
|
|
- `start` - Start a mock API server from an OpenAPI specification
|
|
- `generate` - Generate code/structure from an OpenAPI spec (dry-run mode)
|
|
- `show-config` - Show the current configuration
|
|
|
|
## Configuration
|
|
|
|
Create a `mockapi.yaml` file:
|
|
|
|
```yaml
|
|
port: 8080
|
|
host: 0.0.0.0
|
|
delay: 100
|
|
random_delay: false
|
|
seed: 42
|
|
validate_requests: true
|
|
```
|
|
|
|
## License
|
|
|
|
MIT |