Repository navigation
Conversation
…ared error schema and dated examples - Scope GET /candles/:assetA/:assetB to req.network with AND network predicate and echo network in response (Divinity-Labs#209) - Add candlesResponseSchema and regression test seeding both networks at one pair_key - Document every route error status via shared Error component and extend coverage tests (Divinity-Labs#271) - Add realistic dated response/request examples to all routes and regen openapi.json (Divinity-Labs#270)
|
@Belzabeem Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…andles from/to binding - openapi: POST /verify 400/500 and POST /settle 400 now reference the shared Error component (new InternalServerError component for /verify 500) instead of inlining domain response schemas - tests/openapi.test.ts: scope the inline copied error-schema check to operation-level responses so components.schemas.Error and the PaymentRequired/TooManyRequests envelopes stay valid - src/__tests__/candles.test.ts: from/to are SQL params $4/$5 now that network is bound as $3
Belzabeem
force-pushed
the
fix/candles-network-and-openapi-errors-examples
branch
from
October 17, 2026 07:39
d398929 to
3f9890e
Compare
Author
Please review my pr |
Miracle656
added a commit
that referenced
this pull request
Oct 22, 2026
tsc --noEmit clean vitest 97 files, 1127 passing (up from 93 / 1068) dropped-tests none #325 GET /movers for market gainers and losers #327 GET /correlation for basket construction #485 net arbitrage spread against fees #494 declare the resources capability and expose pages over MCP Two fixes on merge. #325 shipped the route file and the OpenAPI entry but never registered it. The repo's own guard caught it: AssertionError: Documented but unregistered: ["GET /movers"] So the endpoint was documented, generated into clients, and did not exist. registerMoversRoutes already followed the house signature, so wiring it was an import and a call next to registerScreenerRoutes. That guard is worth its weight -- a documented route that 404s is worse than an undocumented one, because a client is generated against it. #327 added a console.error to src/routes/correlation.ts, which the logging hygiene test forbids. Now createLogger, the same change #388 and #318 needed in the previous batch. Three PRs in two batches have tripped that test, which suggests the rule is not discoverable enough from the outside -- worth a line in CONTRIBUTING rather than catching it per-PR. NOT merged, each failing on its own branch rather than from merge order: #460 Phoenix AMM adapter -- 5 failures alone, including its own networkVenueConfig and venues/registry tests #353 1 tsc error #354 1 tsc error #482 4 tsc errors #393 #431 #434 #472 conflict Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
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.
================================================================================
PULL REQUEST: fix(candles/network) + fix(openapi error/schema+examples)
Branch: fix/candles-network-and-openapi-errors-examples
PROBLEM SUMMARY
Four long-standing issues were fixed in this branch. Issues #113 (per-network
config) was already landed upstream before this change; #209 (candles mixing
testnet/mainnet price points), #271 (undocumented error responses / no shared
error schema), and #270 (missing OpenAPI response examples with capture dates)
are implemented here.
Closes Restructure
config.tsinto a per-network config map #113 - Per-network config (already landed, no changes in this PR)The config restructure lives in a prior commit and is NOT modified here.
Full details are documented in src/config.ts (NetworkConfig type, the
networks.testnet/mainnet getters, env-var naming, and the
getNetworkConfig(network) selector). It is listed for reference and to
keep this PR scope explicit.
Closes /candles/:assetA/:assetB aggregates testnet and mainnet price_points into the same candle #209 - Candles aggregating testnet and mainnet price points into the same
candle
(req.network is declared by src/middleware/network).
(pair_key, network) stays in its own GROUP BY bucket.
fix: scope /price/:assetA/:assetB/history to the request network #308 fix for /price/:assetA/:assetB/history.
from, to, candles) so dev/test request validation and any OpenAPI
generator see the new field.
pair_key with far-apart prices per network, boots the app, and asserts
every candle respects its own network boundary and the fallback.
(enum testnet|mainnet) and a network response field.
the per-request list where the spec places it.
Closes Error responses are undocumented #271 - Undocumented route error responses; no shared error schema
(error, optional message, code).
PaymentRequired, TooManyRequests, and InternalServerError reference
#/components/schemas/Error (no inline copies).
409, 429, 500 as applicable). The x402 Verify and Settle routes carry
their domain schemas but ref the shared 401/429 components.
body schema; every error status references it; no inline
type-string error copies survive; every route has at least one
documented error status.
Closes The spec has no examples #270 - Missing OpenAPI response examples with capture dates
request/response example plus a captured timestamp (ISO 8601).
date is documented verbatim in the 204 response description.
(seed issuers, pool IDs, history rows, error reason enums); no invented
contract IDs and no elided short IDs.
generator/regex are stable and future regenerations will not drift.TECHNICAL NOTES
config.environment.ts
HORIZON_URL, RPC_URL, NETWORK_PASSPHRASE, SOROSWAP_FACTORY_ADDRESS,
REFLECTOR_CONTRACT_ID, and WATCHED_PAIRS.
paths are preserved for callers that relied on the old strings.
Endpoint matrix (openapi.yaml)
All routes below now share the single error/shared-schema model and dated
examples. DELETE /webhooks/{id} is the sole 204 exception.
Candles: GET /candles/{assetA}/{assetB}
History: GET /price/{assetA}/{assetB}/history
TWAP: GET /price/twap/{assetA}/{assetB}
VWAP: GET /price/vwap/{assetA}/{assetB}
Depth: GET /price/{assetA}/{assetB}/depth
Route: GET /price/{assetA}/{assetB}/route
OHLCV/AMM: GET /price/{assetA}/{assetB}/ohlcv-amm
Best: GET /price/best-route/{assetA}/{assetB}
Prices: GET /prices/history
Screener: GET /screener
Pools: GET /pools
Pairs: GET /pairs
Spreads: GET /spreads/{asset}
Volumes: GET /volumes/{asset}
Status: GET /status
Auth: POST /auth
Verify: POST /verify
Settle: POST /settle
Basket: POST /basket
Webhooks: POST /webhooks, GET /webhooks, GET /webhooks/{id}, DELETE
/webhooks/{id}
x402: POST /pay/prepare, GET /pay/{txHash}/status
Usage: GET /usage/me, GET /usage
Others: GET /supported, GET /graphql (GraphiQL), WS /ws, /metrics, admin
routes
Return payloads now include capture dates:
OpenAPI example keys.
VALIDATION / TESTING
Static checks performed (node + regex on openapi.yaml):
type-string error copies.
node_modules environment).
Run the suite once node_modules is complete:
candlesNetwork.test.ts regression test)
CONDITIONS OF CONTRIBUTION
Per the repo CONTRIBUTING.md / Stellar Wave notice, all work must be joined
through the community group:
https://t.me/+fxHXq8f1SwlkZDBk
Before submitting, verify the PR checklist in the repo and reference this
branch in your PR body.
REVIEW CHECKLIST
[ ] Candles endpoint is network-scoped (AND network = $3) and echoes network.
[ ] Regression test seeds testnet + mainnet at one pair_key and passes.
[ ] One shared Error component; all error responses reference it (no copies).
[ ] Every public route documents error statuses (400/401/402/404/409/429/500).
[ ] Every route has a request + response example with captured: 2026-10-16.
[ ] DELETE /webhooks/{id} still 204-no-body and documented.
[ ] openapi.json regenerates byte-identically (deterministic).
[ ] README marker text no longer conflicts with the spec.
[ ] Full npm test passes after npm install.
Files changed
M README.md
M openapi.json
M openapi.yaml
M src/api/schemas.ts
M src/routes/candles.ts
M tests/openapi.test.ts
A src/tests/candlesNetwork.test.ts