Skip to content

Latest commit

 

History

History
13 lines (7 loc) · 1.03 KB

openapi.md

File metadata and controls

13 lines (7 loc) · 1.03 KB

What is the Klaw API source of truth?

The OpenAPI spec ./openapi.yaml at the root of the project is our source of truth. It is auto-generated from the current state of the API code when mvn verify is ran from core, and is therefore always up to date with the current state of the API.

We use this OpenAPI spec as a source for the generation of the TypeScript types the frontend relies on to accurately type our business logic (mainly in the .coral/domain folder). The script to generate those types is extract-api-types in coral/package.json, and the output can be seen in coral/types/api.d.ts.

Therefore, every time the API changes, the OpenAPI spec will change, and the generated types for the frontend will keep in sync with the evolution of the API.

Generating the OpenAPI spec and TypeScript types

This is a high level diagram of the process described above.

Diagram illustrating the flow described in the previous paragraph