Skip to content

fix(openapi): align response schemas with actual API responses - #5674

Merged
martinconic merged 2 commits into
masterfrom
fix/openapi-response-drift
Oct 26, 2026
Merged

martinconic merged 2 commits into
masterfrom
fix/openapi-response-drift

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

Stacked on #5673. Please review and merge that one first; this PR then retargets to master.

I ran the new Schemathesis conformance check from #5673 against a testnet node. It found 29 places where the spec disagrees with what bee actually returns. This PR fixes the spec to match the real responses. No Go code changes, and API behavior doesn't change.

What was wrong in the spec

Spec said Bee actually returns Affects
Errors are application/problem+json application/json Every error response
Error reasons is a list of strings A list of {field, error} objects Every error response
Ethereum addresses have no 0x prefix 0x prefixed, EIP-55 checksummed. Batch owner is the exception: plain hex without 0x /wallet, /addresses, chequebook, transactions, envelope
Fields are always present Can be null lastreceived/lastsent cheques, /loggers, /topology peer lists
Balance thresholds are numbers Never set, always null (thresholds are in /accounting) /balances, /consumed
Tag address is always a 64-char hex Empty string until the upload is finalized /tags
/pins/check can only fail with 500 Returns 429 while a check of all pins is already running /pins/check

For inputs, /feeds/{owner} and /wallet/withdraw accept the address with or without 0x. /soc/{owner} only accepts it without 0x, because that handler decodes plain hex.

Result

  • Schemathesis against a testnet node: 29 failures before, 0 after.
  • Redocly lint: no errors.

About the oasdiff report on this PR

oasdiff will show about 350 "breaking" changes. Almost all of them are the same two fixes to the shared error response (content type and reasons), repeated for every endpoint. None of this changes what bee sends. The spec now describes what clients already receive, so clients that work against the real API are not affected.

Not fixed here

  • /pins/check streams NDJSON but sends a Content-Type: application/json header. The spec already describes the stream correctly. Fixing the header is a code change, so I left it out and excluded /pins/check from the conformance run for now.
  • GET /chunks/0000…0000 returns 500 read chunk failed instead of a 4xx. This looks like a handler bug, not spec drift.

Open API Spec Version Changes (if applicable)

8.2.1 → 8.2.2 (patch: the documentation is corrected to match existing behavior).

Motivation and Context (Optional)

Part of #4974: getting the spec accurate enough that bee-js and other clients can be generated from it. Once this is merged and the conformance check stays green, we can make it blocking.

Related Issue (Optional)

#4974, depends on #5673

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.

Comment thread openapi/Swarm.yaml Outdated
Comment thread openapi/SwarmCommon.yaml Outdated
Comment thread openapi/SwarmCommon.yaml Outdated
Base automatically changed from chore/openapi-ci-checks to master October 23, 2026 09:59
Fix the mismatches found by running Schemathesis against a node:

- error responses are application/json, and reasons are objects
  with field and error, not strings
- Ethereum addresses are returned with a 0x prefix
- balance thresholds, last cheques, logger lists and topology peer
  lists can be null
- tag address is an empty string until the upload is finalized
- document the 429 response of /pins/check

Exclude /pins/check from the conformance run, because it streams
NDJSON with an application/json content type.

Bump the API version to 8.2.2.

Refs: #4974
- require the 0x prefix on EthereumAddress, which is only used for
  common.Address fields
- document the batch owner as hex without the 0x prefix
- accept both forms on the feeds owner and withdraw address inputs
- describe balance thresholds as always null on /balances and
  /consumed, and point to /accounting
- explain when /pins/check returns 429
@martinconic
martinconic merged commit e3a97f6 into master Oct 26, 2026
19 checks passed
@martinconic
martinconic deleted the fix/openapi-response-drift branch October 26, 2026 13:38
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.

3 participants