feat(api-client): generated BFF client library (closes #66) #70

Merged
not merged 3 commits from feat/66-api-client into main 2026-07-01 10:51:02 +00:00
Contributor

What & why

S-08blibs/api-client, a generated typed client for the BFF (§10: generated, never
hand-written). Generated from services/bff/openapi.json with orval (Angular target → an
injectable BffApiV1Service on HttpClient), so the DigiD bearer can later be attached by an
HttpInterceptor (S-08c). Consumed by the self-service form next.

Closes #66

Definition of Done

  • Linked Gitea issue (above).
  • Failing test before implementation (barrel didn't export the client → red; export → green).
  • Conventional Commits referencing the issue (refs #66).
  • CI: frontend lane covers it (lint + test); generation is a repeatable nx target.
  • Docs — docs/frontend-decisions.md entry (generator choice + regen command).
  • Not user-visible → no demo-script note.

Notes for reviewers

  • Generator: orval (node-based) — no Java, so it runs in the pnpm/Node lane; emits an Angular
    HttpClient service (interceptor-friendly). Config: libs/api-client/orval.config.ts. Regenerate
    with nx run api-client:generate (idempotent; src/lib/generated/ is never hand-edited).
  • Tested against a mocked BFF via HttpClientTesting: POST /self-service/registrations and
    GET /openbaar/register?q=…, mapping typed SubmitAccepted / OpenbaarEntry.
  • Normalised the Nx vitest target to test (was vite:test) so app + libs share the target and
    make frontend's run-many -t test covers libraries too.
  • The BFF endpoints have no operationId, so orval synthesises method names — adding explicit
    operation ids to the BFF is possible later polish (noted in frontend-decisions).
  • Large diff is mostly the generated client + lockfile.

🤖 Generated with Claude Code

## What & why **S-08b** — `libs/api-client`, a **generated** typed client for the BFF (§10: generated, never hand-written). Generated from `services/bff/openapi.json` with **orval** (Angular target → an injectable `BffApiV1Service` on `HttpClient`), so the DigiD bearer can later be attached by an `HttpInterceptor` (S-08c). Consumed by the self-service form next. Closes #66 ## Definition of Done - [x] Linked Gitea issue (above). - [x] Failing test before implementation (barrel didn't export the client → red; export → green). - [x] Conventional Commits referencing the issue (`refs #66`). - [x] CI: `frontend` lane covers it (lint + test); generation is a repeatable `nx` target. - [x] Docs — `docs/frontend-decisions.md` entry (generator choice + regen command). - [x] Not user-visible → no demo-script note. ## Notes for reviewers - **Generator: orval (node-based)** — no Java, so it runs in the pnpm/Node lane; emits an Angular `HttpClient` service (interceptor-friendly). Config: `libs/api-client/orval.config.ts`. Regenerate with **`nx run api-client:generate`** (idempotent; `src/lib/generated/` is never hand-edited). - **Tested against a mocked BFF** via `HttpClientTesting`: `POST /self-service/registrations` and `GET /openbaar/register?q=…`, mapping typed `SubmitAccepted` / `OpenbaarEntry`. - Normalised the Nx vitest target to **`test`** (was `vite:test`) so app + libs share the target and `make frontend`'s `run-many -t test` covers libraries too. - The BFF endpoints have no `operationId`, so orval synthesises method names — adding explicit operation ids to the BFF is possible later polish (noted in frontend-decisions). - Large diff is mostly the generated client + lockfile. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
not added 3 commits 2026-07-01 10:33:28 +00:00
Scaffold libs/api-client (Nx Angular lib) and generate a typed HttpClient client
from services/bff/openapi.json with orval (node-based; Angular target integrates
with HttpClient interceptors for the S-08c auth token). A failing test drives the
public API: it expects an injectable BffApiV1Service to POST /self-service/registrations
and GET /openbaar/register (via HttpClientTesting), but the lib barrel doesn't export
the client yet, so it fails. Normalise the vitest target to 'test'. Green exposes it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The lib barrel exports the generated BffApiV1Service + models (SubmitAccepted,
OpenbaarEntry), so the app can inject a typed client for the BFF. Add an
'api-client:generate' target (orval) to regenerate from services/bff/openapi.json;
generation is idempotent. Tests (HttpClientTesting) now pass: POST /self-service/
registrations and GET /openbaar/register with the query, mapping typed responses.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
docs(api-client): record the orval generator choice (refs #66)
All checks were successful
CI / lint (pull_request) Successful in 1m4s
CI / build (pull_request) Successful in 49s
CI / unit (pull_request) Successful in 57s
CI / frontend (pull_request) Successful in 1m17s
CI / mutation (pull_request) Successful in 3m48s
CI / verify-stack (pull_request) Successful in 5m49s
fcdb117768
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
not added the type:slicearea:portal-self-service labels 2026-07-01 10:33:37 +00:00
not merged commit 311aab0aba into main 2026-07-01 10:51:02 +00:00
Sign in to join this conversation.