EndpointConfig

@Serializable
data class EndpointConfig(val id: String, val name: String, val path: String, val method: String) : EndpointDefinition

Configuration for a single API endpoint that can be mocked.

An endpoint represents a specific API call (combination of HTTP method and path) that can have multiple mock responses. Endpoints are defined in the shared pool of an ApiGroupConfig and apply to all environments unless overridden via EndpointOverride or supplemented via EnvironmentConfig.additionalEndpoints.

All fields are non-null — this is a complete, self-contained endpoint definition. Use EndpointOverride to express a partial replacement for a specific environment.

Mock response files for an endpoint should be placed at:

responses/{groupId}/{environmentId}/{endpointId}/   ← environment-specific (highest priority)
responses/{groupId}/{endpointId}/ ← shared fallback (lowest priority)

following the naming convention: {endpointId}-{statusCode}[-{suffix}].json

Path Parameters

Paths can include parameters using curly braces notation. Parameters will match any value in that position:

  • Path: /api/users/{userId} matches /api/users/123, /api/users/abc, etc.

  • Path: /api/posts/{postId}/comments/{commentId} matches any values for both IDs

Response File Convention

For an endpoint with id = "getUser" in group "my-backend":

responses/my-backend/getUser/
├── getUser-200.json (Shared success response)
└── getUser-404.json (Shared not found response)
responses/my-backend/staging/getUser/
└── getUser-200.json (Staging-specific success response — overrides shared)

Usage Example

{
"id": "getUser",
"name": "Get User Profile",
"path": "/v1/users/{userId}",
"method": "GET"
}

See also

Constructors

Link copied to clipboard
constructor(id: String, name: String, path: String, method: String)

Properties

Link copied to clipboard
open override val id: String

Unique identifier for this endpoint within its ApiGroupConfig. Used for state persistence, file discovery, and override matching.

Link copied to clipboard
open override val method: String

HTTP method (GET, POST, PUT, DELETE, PATCH, etc.)

Link copied to clipboard
open override val name: String

Human-readable name displayed in the UI

Link copied to clipboard
open override val path: String

API path with optional {param} placeholders (e.g. "/v1/users/{userId}")