Version v0.5.7 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.
Add or change an /api/v2/ endpoint
Change the public HTTP API without breaking the Airflow UI, starting from the OpenAPI document and ending with a guarded, tenant-scoped handler.
The rules are in internal/api/AGENTS.md.
/api/v2/ follows Airflow 3.2.x, so read the
Airflow compatibility checklist
before you design the change.
- Start from the OpenAPI document. Edit
docs/api/openapi.yaml, then copy it tointernal/api/openapi.yaml, which the server embeds (TestEmbeddedOpenAPIMatchesDocsfails while they differ). An Airflow path keeps Airflow’s parameters and response fields; Dexaflow-only data goes in an added field or a separate route. - Regenerate the client:
make pkg-client(make pkg-client-checkfails on drift, and so does CI). - Write the handler test first in
internal/api/, including the responses for a caller without the permission and for a caller of another tenant. - Register the route behind a gate:
RequirePermission,RequireScopedPermissionfor a write a scoped token may call, orRequireScope.TestScopeGateClassifiesEveryRoutewalks every route and fails aGETwith no permission check and a scoped write missing fromscopedWrites. - Scope every read and write to the caller’s tenant with
tenantOf(c)and a storage query that checkstenant_id(internal/storage/AGENTS.md). - Validate every input and answer errors with
AbortProblem, keeping SQL text, host paths and stack traces out of the body (the leak scans inrepo_error_leak_test.goandleakscan_test.go). - Check the UI. When the embedded Airflow UI reads the route, run
test/ui-contract/run.shagainst a local control plane, and add a parameterless path the UI fetches on screen load toTestSPAReferencedRoutesAreRegistered. - Document it. The OpenAPI document is user-facing surface for the docs guard: update the API reference or the page of the feature, and record a changelog fragment (record a change). In a patch, a path, parameter or field is never removed or changed (ADR 0068).
- Check:
go test ./internal/api/ ./internal/domain/andmake lint test.