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.
This is a high level diagram of the process described above.