Repository navigation
ci(openapi): lint spec, report breaking changes and test conformance - #5673
Merged
Merged
Conversation
Add CI checks that keep the hand-written OpenAPI spec in sync with the API handlers, without adding any Go code: - Redocly lint on every PR that touches openapi/ (fails on errors) - oasdiff breaking-change report against the base branch (advisory) - Copilot review instructions for pkg/api and openapi changes - Schemathesis GET conformance run against a live node in the beekeeper job (advisory for now) Fix header parameters that used a parameter object as their schema, which made the spec unloadable for kin-openapi based tools, and add the missing type next to nullable on StakeResponse.minimumDeposit. Refs: #4974
4 of 8 tasks
Install Redocly CLI with npm --ignore-scripts instead of npx, restrict the oasdiff download to HTTPS, and reach the beekeeper node through localhost with a Host header.
martinconic
requested review from
acud,
akrem-chabchoub,
aloknerurkar,
gacevicljubisa and
sbackend123
October 22, 2026 14:07
sbackend123
approved these changes
Oct 23, 2026
This was referenced Oct 23, 2026
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.
Checklist
Description
Our OpenAPI spec is written by hand, and nothing in CI checks it, so it keeps drifting away from what the API really does. This PR adds checks that catch that drift, without adding any Go code to bee.
What runs, and when
openapi/openapi/pkg/api/oropenapi/openapi-checks.yml): checks that the spec is valid. Thesecurity-definedrule is off because the API is unauthenticated by design. Warnings (missingoperationIdand similar) are shown in the log but don't fail the job..github/instructions/openapi.instructions.md): tells Copilot what to compare between handlers and the spec. For automatic reviews, a repo admin needs to enable "Automatically request Copilot code review" in a ruleset. Copilot reads the instructions from the base branch, so they take effect after merge.bee-0and checks status codes, content types and response bodies against the spec. It takes under a minute. WebSocket endpoints and/rchashare excluded.Spec fixes included
Lint failed with 29 errors on master. Almost all of them came from header parameters (under
/grantee,/chunks,/socand others) that used a whole parameter object as theirschema. Besides being invalid, this stops kin-openapi based tools, oasdiff included, from loading the spec at all. They now reference the parameter directly. I compared the resolved spec before and after: all 94 operations have the same parameter names, locations, required flags and schemas. The other fix adds a missingtypenext tonullableonStakeResponse.minimumDeposit.What's next
Running Schemathesis against a testnet node found 28 places where the spec and the responses disagree (for example
0xprefixed addresses,nullfields, the error content type). The fixes are in a follow-up PR on top of this one. Once Schemathesis stays clean for a while, we can make it blocking by removingcontinue-on-error.Open API Spec Version Changes (if applicable)
None. These are fixes to invalid YAML, and the documented API is unchanged.
Motivation and Context (Optional)
Issue #4974 asks for a spec that can be trusted, so that bee-js and other clients can be generated from it. We decided against generating the spec from Go code, so as not to add tooling code to bee. This PR keeps the hand-written spec honest through CI instead.
Related Issue (Optional)
fixes #4974
AI Disclosure