From c3f0710a184051a186e62733a50dbdc1970caa7c Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Wed, 1 Jul 2026 12:32:07 +0200 Subject: [PATCH] feat(api-client): expose the generated BFF client + repeatable generate target (refs #66) 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) --- libs/api-client/project.json | 7 +++++++ libs/api-client/src/index.ts | 4 +++- libs/api-client/src/lib/bff-api.spec.ts | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libs/api-client/project.json b/libs/api-client/project.json index 2f27cea..395830d 100644 --- a/libs/api-client/project.json +++ b/libs/api-client/project.json @@ -8,6 +8,13 @@ "targets": { "lint": { "executor": "@nx/eslint:lint" + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "orval --config orval.config.ts", + "cwd": "libs/api-client" + } } } } diff --git a/libs/api-client/src/index.ts b/libs/api-client/src/index.ts index cb0ff5c..304d49d 100644 --- a/libs/api-client/src/index.ts +++ b/libs/api-client/src/index.ts @@ -1 +1,3 @@ -export {}; +// The BFF API client is generated from services/bff/openapi.json (orval); never hand-edit +// src/lib/generated. Re-run `nx run api-client:generate` after the BFF spec changes. +export * from './lib/generated/bff-api'; diff --git a/libs/api-client/src/lib/bff-api.spec.ts b/libs/api-client/src/lib/bff-api.spec.ts index eafc695..5f6451d 100644 --- a/libs/api-client/src/lib/bff-api.spec.ts +++ b/libs/api-client/src/lib/bff-api.spec.ts @@ -8,7 +8,7 @@ import { BffApiV1Service, type OpenbaarEntry, type SubmitAccepted, -} from 'api-client'; +} from '../index'; describe('BffApiV1Service (generated from services/bff/openapi.json)', () => { let service: BffApiV1Service;