Appearance
ADR-2346: Route terminology APIs through the gateway
Also known as: ADR-058 (former number)
- Status: Accepted
- Date: 2026-08-07
- Authors: @fderuiter
- Deciders: @fderuiter
1. Context & Problem Statement
The Metadata Designer microservice exposes controlled terminology validation and search endpoints at /api/v1/terminology. To allow downstream clients and external services to securely consume these terminology services, they must be routed through the unified API Gateway. At the same time, we must preserve GxP security headers, signed identity headers, and maintain existing study-scoped routing precedence.
This decision implements requirements under Trace-8.
2. Decision Drivers & Constraints
- Unified Entrypoint: Direct clients should always interact with the API Gateway instead of hitting microservices directly.
- Security & Auditing: The gateway must enforce valid token verification and inject correct downstream headers, including
X-User-Id,X-User-Roles,X-Gateway-Timestamp,X-Gateway-Signature, andX-Signature-Version. - Router Precedence: Existing studies route prefix
/api/v1/studiesmust remain reachable and untouched to keep study-scoped validation paths working seamlessly.
3. Options Considered
Option 1: Route directly via explicit gateway rules
- Overview: Add explicit routing rules in
apps/gateway/main.pymappingapi/v1/terminologyandterminology/path prefixes directly toSERVICES['designer']. - Pros:
- ✅ Highly explicit and robust routing matching existing platform patterns.
- ✅ Preserves signed identity propagation and audit contexts perfectly.
- ✅ Maintains existing route precedence.
- Cons:
- ❌ Requires code modification in the main gateway routing logic.
Option 2: Route as part of a generic wildcard
- Overview: Rely on fallback wildcard proxy routing in the gateway.
- Pros:
- ✅ No direct gateway code edits needed.
- Cons:
- ❌ Wildcard fallbacks are implicit and highly prone to regression if route configurations in other services overlap or change.
- ❌ Lacks explicit verification of routing behavior in tests.
4. Decision Outcome
- Chosen Option: Option 1
- Justification: Option 1 guarantees high reliability, explicit test coverage, and strict enforcement of the expected routing destination.
5. Consequences & Trade-offs
- Positive Impact:
- Terminology validation and search paths route perfectly to the Metadata Designer.
- Fully compliant digital signatures and Part 11 auditing propagation are enforced.
- Negative Impact / Technical Debt:
- None identified.
6. Implementation & Verification
- Affected Repositories / Services:
apps/gateway/main.pytests/test_gateway.py
- Verification Plan:
- Unit Tests: Execute
uv run pytest tests/test_gateway.pyto verify routing targets and header presence.
- Unit Tests: Execute