api-commons is a lightweight API contract spring boot library that standardizes how services in the platform receive requests and return responses.
It provides data structures that help enforce a consistent API architecture across all services while keeping business logic independent from framework concerns (e.g., Spring HTTP types).
The library introduces unified abstractions for:
- API requests
- API responses
- Paginated responses
This library is designed to support any project by providing generic components that are not tied to a specific domain. It can be used by any service that needs to implement an API contract, regardless of its underlying business logic or data models.
ServiceRequest wraps all incoming request components into a single structure passed to the service layer.
It provides generic access to:
- Path variables
- Query parameters
- Request body
- Headers
- Request meta data
ServiceResponse standardizes how services return data to the client.
It provides generic access to:
- Response body
- Response headers
- Response business status code