ADR 0005: Use Generated OpenAPI and MapStruct

Status

Accepted

Context

The project should document its REST API and avoid repetitive hand-written mapping code at the module boundaries. Both concerns should be automated by Maven so reviewers can verify them from a clean checkout.

Decision

Use springdoc-openapi to expose runtime API documentation. Configure OpenAPI metadata, paths, Swagger UI, and grouping through ecommerce-app/src/main/resources/openapi.yaml. Use a Maven profile named generate-openapi to export openapi.json during the unified CI documentation build. Publish both the raw JSON and a static Swagger UI page on GitHub Pages.

Use MapStruct for REST boundary mapping between application models and HTTP DTOs. Mapper implementations are generated by the Maven compiler plugin during compilation.

Consequences

Benefits:

Trade-offs: