Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

ADR-BW-011: Reuse request validation and structured HTTP errors

Validate applicable requests before handlers and expose predictable HTTP problem responses without leaking internal exception details.

November 7, 2026Proposed
FieldValue
StatusProposed
Date2026-11-07
OwnersArchitecture Enabling TeamTeamArchitecture Enabling TeamEnabling team facilitating BookWorm's architecture governance, ADRs, arc42 documentation, engineering standards, testing...Open docs
Affected ResourcesBookWormDomainv1.0.0BookWormCore e-commerce domain for the BookWorm online bookstore, coordinating catalog discovery, customer baskets, order fulfil...Ownerarchitecture-enabling-teamDiagramRepositoryOpen docs
Related ADRsADR-BW-009: Use local CQRS handlers and the established MediatorDecision Recordv1.0.0ADR-BW-009: Use local CQRS handlers and the established MediatorReuse CQRS and Mediator.SourceGenerator for in-process request handling without treating local messages as service integ...Ownerarchitecture-enabling-teamOpen docs, ADR-BW-013: Use shared structured logging and OpenTelemetryDecision Recordv1.0.0ADR-BW-013: Use shared structured logging and OpenTelemetryProduce correlated logs, traces, metrics, and configured health signals while keeping business completion separate from ...Ownerplatform-engineering-teamOpen docs

Context & Problem Statement

Every HTTP API in BookWormDomainv1.0.0BookWormCore e-commerce domain for the BookWorm online bookstore, coordinating catalog discovery, customer baskets, order fulfil...Ownerarchitecture-enabling-teamDiagramRepositoryOpen docs handles invalid payloads, missing resources, rate limits, and unexpected faults. If each service invents its own error schema or leaks raw stack traces, microfrontends become brittle and internal implementation details are exposed to callers.

Decision Drivers

  • Early rejection: Validate inputs before executing business logic or database writes.
  • Contract consistency: Return RFC-compliant ProblemDetails across all HTTP services.
  • Information security: Keep stack traces and internal exception details out of client responses.

Options Considered

OptionProsCons
Shared validation pipeline + standard ProblemDetails errorsConsistent client error handling; invalid requests blocked earlyServices must register validators and domain exception mappings
Ad-hoc per-endpoint validation and errorsZero shared-pipeline setupError formats and status codes diverge across services
Return raw exception details to clientsFaster ad-hoc debuggingLeaks internal schemas, paths, and stack traces
Mask failures behind 200 OK responsesUniform HTTP statusBreaks HTTP semantics and misleads retry logic

Decision & Consequences

Chosen Option: Validate requests in a shared pre-handler pipeline and map failures to standardized ProblemDetails HTTP responses carrying a correlation trace ID. Detailed exception diagnostics remain strictly in protected OpenTelemetry logs.

  • Positive: Storefront and Backoffice handle validation, 404, 409, 429, and 500 responses uniformly.
  • Negative: Every new command or query must include an explicit validator and exception mapping where applicable.

Compliance Criteria

  • HTTP APIs must return ProblemDetails for validation (400), missing (404), conflict (409), rate-limit (429), and server (500) errors.
  • Production error responses must never expose stack traces, SQL errors, or internal file paths.
  • Request validation must run in the shared pipeline before handler execution.