Conta HTTP

conta-http is Conta’s shared, open-source library for HTTP / API conventions on both sides of the call.

It standardizes how our APIs bind paginated requests and how they shape responses. It is the home of Conta’s standardized API response envelope.

The two pillars

Request binding

The @RequestBean-enabled Paging params class converts page/size/order query parameters into a Micronaut Pageable. The QueryParamGuard rejects any query parameter that no endpoint binding declares.

Response shaping

The Envelope<T> interface is the standardized response envelope; the concrete shapes are SingleEnvelope and SliceEnvelope. Envelopes.slice(…​) turns a Micronaut Page or Slice into a SliceEnvelope. On the client side, @UnwrapEnvelope lets a declarative @Client declare the inner payload type and have the envelope’s content lifted transparently.

Modules

conta-http-kit carries the server-side pillars (request binding and response shaping); conta-http-client-kit carries the client-side conventions; conta-http-mock-server is a test-support module for testing HTTP clients.

Module Package Contents

conta-http-kit

no.conta.http

Envelope<T>, SingleEnvelope, SliceEnvelope — the standardized response envelope (plain Lombok, no serialization annotations).

conta-http-kit

no.conta.http.problem

HttpProblemCode — standard STD-2xxx problem codes (no Micronaut dependency).

conta-http-kit

no.conta.http.mn

Paging, Envelopes, QueryParamGuard, OrderFieldsGuard, OrderFields — the Micronaut request/response helpers.

conta-http-client-kit

no.conta.http.client.mn

@UnwrapEnvelope — transparent envelope unwrapping for declarative @Client interfaces.

conta-http-mock-server

no.conta.http.mock

Mock HTTP server for testing clients — MockServerSpec / MockServer + MockHttpHandler (test-support, testImplementation).

Getting started

See Getting started for the dependency coordinate and Micronaut wiring.