798 B
798 B
Backend API contract generation
From the repository root:
dotnet run --project tools/ContractGenerator -- .
dotnet run --project tools/ContractGenerator -- . --check
node scripts/check-api-contract.mjs
The tool reads public DTOs registered in WebDrop.Api.ApiJson and their referenced types. It writes TypeScript interfaces to web/src/core-bridge/generated/api.ts and JSON Schema definitions to contracts/api.schemas.json. OpenAPI references these generated schemas. Backend-to-Cap serialization uses a separate context and is excluded from the browser contract.
Reflection is used only by this development tool. The production API keeps source-generated, NativeAOT-compatible serialization. Generated files are committed; no extra runtime dependency is added to the frontend.