docs: publish the OpenAPI document - #37
Open
tuliomir wants to merge 1 commit into
Open
Conversation
The README advertised a canonical API document that did not exist. Adds `docs/openapi.yaml` describing all seven operations, the shared error schema with every code mapped to its status and `retryable` value, the `X-Test-Name` and `x-request-id` headers, the `/status` diagnostic body, and the readiness reasons. Based on the readiness fix rather than main, because the contract it documents is the one that ships with that fix: the spec carries the `funding_initializing` reason and states that `/fund` refuses exactly the phases `/ready` refuses. Documenting the pre-fix behaviour would have made this stale on the day it merged. Derived from the handlers rather than the README, which turned out to have the readiness evaluation order wrong: the funds query runs inside `currentReadiness` before `computeReadiness` is reached, so `funds_query_error` precedes `wallet_unfunded`. The README table is corrected to match. CI validates the document against the OpenAPI meta-schema. The validator is a devDependency resolved from the lockfile rather than fetched at run time, so a registry blip cannot fail an unrelated PR and Dependabot can watch it — which also means npm joins the ecosystems it covers, with the same cooldown and patch-filtering posture as actions. A unit test pins `info.version` to package.json. Client generators stamp that value into generated metadata, so a stale one misleads; the schema validator would accept any semver string. `CONTRIBUTING.md` referenced `docs/OPENAPI.yaml` in the wrong case and `docs/AGENT-CONTRACT.md`, which has never existed in this repository. The first now resolves; the second is dropped, its retry/error/readiness role folded into the document this commit adds. Schema validation cannot detect the spec disagreeing with the handlers — tracked in #33. Closes #29 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
The README advertised a canonical OpenAPI document that did not exist. Adds
docs/openapi.yamldescribing all seven operations, the shared error schema with every code mapped to its status andretryablevalue, theX-Test-Nameandx-request-idheaders, the/statusdiagnostic body, and the readiness reasons.It is based on #25 rather than
mainbecause the contract it documents is the one that ships with that fix: the spec carries thefunding_initializingreason and states that/fundrefuses exactly the phases/readyrefuses. Documenting the pre-fix behaviour would have made this stale on the day it merged.How it works
__tests__/src/openapi-version.test.ts(new) — pinsinfo.versiontopackage.json. Client generators stamp that value into generated metadata, so a stale one misleads, and the schema validator would accept any semver string.docs/OPENAPI.yamlin the wrong case anddocs/AGENT-CONTRACT.md, which has never existed in this repository. The first now resolves; the second is dropped, its retry/error/readiness role folded into the document this PR adds.Behavioral change
None at runtime. One documentation correction: the README's readiness table listed
wallet_unfundedbeforefunds_query_errorunder "evaluated in this order". The funds query runs insidecurrentReadinessbeforecomputeReadinessis reached, so a failed query never reaches the funded/unfunded decision —funds_query_errorcomes first. The table is corrected to match the code.Known limitation
Schema validation proves the document is well-formed, not that it describes this service. Nothing yet detects the spec disagreeing with the handlers — tracked in #33, which also names the concrete case already queued (#31 changes the
/multisigWalletresponse).Acceptance criteria
bun run validate:openapipasses locally and in CI, and fails on a malformed document or a dangling$ref.retryablevalue, and the/statusbody are described.info.versionmatchingpackage.jsonis enforced by a test.Closes #29
Stack created with GitHub Stacks CLI • Give Feedback 💬