docs(api): add OpenAPI 3.1 spec for HTTP API#11
Open
Kures wants to merge 1 commit into
Open
Conversation
Closes P2-04 from reference/todo.md. Adds docs/openapi.yaml describing all 36 HTTP operations and their request/response shapes, plus docs/api/README.md with viewer and SDK-generation instructions. The spec is reverse-engineered from src/api.zig and src/types.zig on main and validates clean with python -m openapi_spec_validator. Coverage: - 31 paths / 36 operations - 30 schemas (run, step, worker, workflow, checkpoint, tracker, ...) - 5 reusable parameters, 3 reusable responses - security: bearerAuth on everything except /health and /metrics - documents idempotency contract for POST /runs - documents drain mode behavior for POST /admin/drain Drives downstream work: - generated SDKs (TypeScript, Python, Go) via openapi-generator-cli - Swagger UI / Redoc preview - contract tests against a running orchestrator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR1 —
docs(api): add OpenAPI 3.1 spec for HTTP APIBranch:
docs/openapi-specCloses: P2-04 from
reference/todo.md(OpenAPI spec + generated client SDK for automation integrations)Why
reference/todo.mdlists this as P2-04. Today the only contract for theHTTP API is
src/api.zig(2390 lines). Anyone wanting to build anintegration, generate an SDK, or run a contract test has to read Zig.
What this PR ships
docs/openapi.yaml— OpenAPI 3.1 spec covering all 36 HTTPoperations and their request/response shapes.
docs/api/README.md— viewer instructions (Redoc/Swagger UI),validation commands (Python/Node), and one-command SDK generation
recipes for TypeScript, Python, and Go.
Coverage
All 7 enums from
src/types.zigare modeled (RunStatus,StepStatus,StepType,WorkerStatus,WorkerSource,TrackerTaskState,ReducerType). The 6WorkerProtocolvalues come fromworker_protocol.parseinsrc/worker_protocol.zig.Auth and conventions documented
bearerAuthsecurity scheme (mirrors--api-token/NULLBOILER_API_TOKEN)./healthand/metricsare explicitly public.POST /runs(Idempotency-Keyheaderpreferred,
idempotency_keybody field accepted,409on conflict).POST /admin/drain(503on subsequent runs).{error: {code, message}}envelope.How it was authored
Reverse-engineered from the source of truth on
main:src/api.zig—handleRequestroute table and per-handler bodies.src/types.zig— every enum and DB row type.src/strategy.zig,src/workflow_loader.zig,src/workflow_validation.zig— workflow JSON shape and validation rules.
src/metrics.zig— referenced from the/metricsexample only.info.versionis pinned to2026.3.2(the same versionhandleHealthreturns).How to validate
python -m pip install openapi-spec-validator python -m openapi_spec_validator docs/openapi.yaml # OKor
Why review attention is low-risk
docs/openapi.yamlanddocs/api/are new.info.versionwhen theAPI surface or release version changes — instructions are in
docs/api/README.md.Companion repo: working TypeScript SDK
A reference TypeScript client generated from this spec lives at
Kures/nullboiler-ts-sdk(separate repo, no PR to this one). It uses the exact
openapi-generator-cli typescript-fetchcommand documented indocs/api/README.mdof this PR — so the spec doubles as a regeneraterecipe. The SDK exposes all 11 API groups behind a single
NullBoilerClient, preservessnake_casefield names from the spec,and ships a
examples/quickstart.tsproven against the demo stack.This closes the second half of P2-04 ("OpenAPI spec + generated
client SDK").
Follow-ups (not in this PR)
docs/api/README.md).(groundwork for P2-03 deterministic replay diagnostics).