MockConfiguration
Root configuration for network mocking, loaded from mocks.json.
This data class represents the complete mock configuration that integrators define in their composeResources/files/networkmocks/mocks.json file. It contains all API group configurations, each of which defines a set of shared endpoints and the environments (deployment stages) in which those endpoints are reachable.
File Location
The configuration file should be placed at:
composeResources/files/networkmocks/mocks.jsonContent copied to clipboard
JSON Structure
{
"apiGroups": [
{
"id": "my-backend",
"name": "My Backend",
"endpoints": [
{
"id": "getUser",
"name": "Get User",
"path": "/v1/users/{userId}",
"method": "GET"
}
],
"environments": [
{
"id": "staging",
"name": "Staging",
"url": "https://staging.api.example.com"
},
{
"id": "production",
"name": "Production",
"url": "https://api.example.com"
}
]
}
]
}Content copied to clipboard
Usage Example
val repository = MockConfigRepository("files/networkmocks/mocks.json")
val config = repository.loadConfiguration().getOrNull()
config?.apiGroups?.forEach { group ->
println("Group: ${group.id}")
group.environments.forEach { env ->
println(" Environment: ${env.id} - ${env.url}")
}
group.endpoints.forEach { endpoint ->
println(" Endpoint: ${endpoint.method} ${endpoint.path}")
}
}Content copied to clipboard