Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
MockForge Core
Core functionality and shared logic for the MockForge mocking framework.
This crate provides the foundational building blocks used across all MockForge protocols (HTTP, WebSocket, gRPC, GraphQL). It can be used as a library to programmatically create and manage mock servers, or to build custom mocking solutions.
Overview
MockForge Core includes:
- Routing & Validation: OpenAPI-based route registration and request validation
- Request/Response Processing: Template expansion, data generation, and transformation
- Chaos Engineering: Latency injection, failure simulation, and traffic shaping
- Proxy & Hybrid Mode: Forward requests to real backends with intelligent fallback
- Request Chaining: Multi-step request workflows with context passing
- Workspace Management: Organize and persist mock configurations
- Observability: Request logging, metrics collection, and tracing
Library feature selection
The minimal-build corrections described here are unreleased.
Default features include data generation, AI, contracts, workspace management, voice, advanced engines, and scripting. Embedded applications can disable the bundle and enable individual features:
= { = "0.3.233", = false, = ["workspace-mgmt"] }
Shared configuration types remain available with default features disabled, so
JSON and YAML configuration can be moved between builds. An engine's configuration
does not enable its Cargo feature. Workspace persistence and synchronization
require workspace-mgmt; continuum blending and behavioral economics require
advanced, which enables workspace management for snapshots and multi-tenant
routing. Voice workspace construction requires workspace management and data
and enables those two prerequisites. The advanced consistency engine enables the
intelligence crate's persona data types because its state contains PersonaProfile.
The targeted configuration and basic request controls can be run independently:
Quick Start: Embedding MockForge
Creating a Simple HTTP Mock Server
use ;
async
Request Chaining
Chain multiple requests together with shared context:
use ;
# async
Latency & Failure Injection
Simulate realistic network conditions and errors:
use ;
// Configure latency simulation
let latency = slow; // 300-800ms
// Configure failure injection
let failure_config = FailureConfig ;
let injector = create_failure_injector;
Key Modules
OpenAPI Support
- [
openapi]: Parse and work with OpenAPI specifications - [
openapi_routes]: Register routes from OpenAPI specs with validation - [
validation]: Request/response validation against schemas
Request Processing
- [
routing]: Route matching and registration - [
templating]: Template variable expansion ({{uuid}}, {{now}}, etc.) - [
request_chaining]: Multi-step request workflows - [
overrides]: Dynamic request/response modifications
Chaos Engineering
- [
latency]: Latency injection with configurable profiles - [
failure_injection]: Simulate service failures and errors - [
traffic_shaping]: Bandwidth limiting and packet loss
Proxy & Hybrid
- [
proxy]: Forward requests to upstream services - [
ws_proxy]: WebSocket proxy with message transformation
Persistence & Import
- [
workspace]: Workspace management for organizing mocks - [
workspace_import]: Import from Postman, Insomnia, cURL, HAR - [
record_replay]: Record real requests and replay as fixtures
Observability
- [
request_logger]: Centralized request logging - [
performance]: Performance metrics and profiling
Feature Flags
This crate supports several optional features:
openapi: OpenAPI specification support (enabled by default)validation: Request/response validation (enabled by default)templating: Template expansion (enabled by default)chaos: Chaos engineering features (enabled by default)proxy: Proxy and hybrid mode (enabled by default)workspace: Workspace management (enabled by default)
Examples
See the examples directory for complete working examples.
Related Crates
mockforge-http: HTTP/REST mock servermockforge-grpc: gRPC mock servermockforge-ws: WebSocket mock servermockforge-graphql: GraphQL mock servermockforge-plugin-core: Plugin developmentmockforge-data: Synthetic data generation