generate_api_mock
Generate realistic JSON mock responses for REST endpoints from a field schema. Define endpoint, fields, and status code to produce test data for API development.
Instructions
Generate mock API responses from a schema. Creates realistic JSON responses for REST endpoints based on field names and types.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of records to generate (default: 1, max: 100) | |
| fields | Yes | Array of field schemas. Each field has: name (string), type (string|number|boolean|date|array|object), optional items (for arrays), optional fields (for nested objects), optional nullable, optional enum. | |
| method | No | HTTP method (default: GET) | |
| endpoint | Yes | API endpoint path, e.g. "/api/v1/users" | |
| status_code | No | HTTP status code for the response (default: 200) | |
| wrap_in_envelope | No | Wrap response in { success, data, meta } envelope (default: true) |