effectiveEndpoints

Builds the effective endpoint list for a given ApiGroupConfig and EnvironmentConfig pair.

This is the single source of truth for endpoint resolution. It combines the group's shared ApiGroupConfig.endpoints pool with the environment's EnvironmentConfig.endpointOverrides and EnvironmentConfig.additionalEndpoints to produce the complete, ready-to-use list of EndpointConfig entries that apply to this specific group + environment combination.

Resolution Steps

  1. Start with ApiGroupConfig.endpoints (the shared pool)

  2. For each shared endpoint, check whether EnvironmentConfig.endpointOverrides contains an entry whose EndpointOverride.id matches — if so, merge it: non-null override fields replace the shared values, null override fields keep the shared values

  3. Append EnvironmentConfig.additionalEndpoints — these endpoints are unique to this environment and are added as-is after the resolved shared endpoints

Override Merge Example

Shared endpoint:

EndpointConfig(id="getUser", name="Get User", path="/v1/users/{userId}", method="GET")

Override:

EndpointOverride(id="getUser", path="/v1/users/{userId}/profile")

Result:

EndpointConfig(id="getUser", name="Get User", path="/v1/users/{userId}/profile", method="GET")

Usage

val effectiveEndpoints = group.effectiveEndpoints(environment)
val match = effectiveEndpoints.firstOrNull { endpoint ->
RequestMatcher.matchesPath(endpoint.path, requestPath) && endpoint.method == requestMethod
}

Receiver

The ApiGroupConfig providing the shared endpoint pool

Return

The fully resolved list of EndpointConfig for this group + environment, in order: resolved shared endpoints first, then additional endpoints

Parameters

environment

The EnvironmentConfig providing overrides and additions

See also