Skip to content

ci(openapi): lint spec, report breaking changes and test conformance - #5673

Merged
martinconic merged 2 commits into
masterfrom
chore/openapi-ci-checks
Oct 23, 2026
Merged

martinconic merged 2 commits into
masterfrom
chore/openapi-ci-checks

Conversation

@martinconic

@martinconic martinconic commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have added or updated fuzz targets for any code handling untrusted input.
  • I have filled out the description and linked the related issues.

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

Check Runs on Blocks merge?
Redocly lint PRs touching openapi/ Yes, on errors
oasdiff breaking changes PRs touching openapi/ No, shows annotations and a summary
Copilot review instructions PRs touching pkg/api/ or openapi/ No, review comments
Schemathesis conformance Beekeeper integration job No, for now
  • Redocly lint (openapi-checks.yml): checks that the spec is valid. The security-defined rule is off because the API is unauthenticated by design. Warnings (missing operationId and similar) are shown in the log but don't fail the job.
  • oasdiff: compares the spec in the PR with the base branch and flags changes that could break API clients such as bee-js. On this PR it only shows a warning, because the current master spec can't be loaded (see below). It works normally once this is merged.
  • Copilot instructions (.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.
  • Schemathesis: after the beekeeper checks pass, it sends valid GET requests to bee-0 and checks status codes, content types and response bodies against the spec. It takes under a minute. WebSocket endpoints and /rchash are excluded.

Spec fixes included

Lint failed with 29 errors on master. Almost all of them came from header parameters (under /grantee, /chunks, /soc and others) that used a whole parameter object as their schema. 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 missing type next to nullable on StakeResponse.minimumDeposit.

What's next

Running Schemathesis against a testnet node found 28 places where the spec and the responses disagree (for example 0x prefixed addresses, null fields, 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 removing continue-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

  • This PR contains code that has been generated by an LLM.
  • I have reviewed the AI generated code thoroughly.
  • I possess the technical expertise to responsibly review the code generated in this PR.

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
Comment thread .github/workflows/openapi-checks.yml Fixed
Comment thread .github/workflows/openapi-checks.yml Fixed
Comment thread .github/workflows/beekeeper.yml Fixed
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.

@acud acud left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done

@martinconic
martinconic merged commit a98e5bd into master Oct 23, 2026
20 checks passed
@martinconic
martinconic deleted the chore/openapi-ci-checks branch October 23, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Automated OpenAPI Specification Tooling

4 participants