Skip to content

feat: perpOB support#35

Open
arturbeg wants to merge 25 commits into
mainfrom
feat/perpOB
Open

feat: perpOB support#35
arturbeg wants to merge 25 commits into
mainfrom
feat/perpOB

Conversation

@arturbeg

@arturbeg arturbeg commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Documents the public REST + WebSocket surface introduced by the feat/perpOB migration in Reya-Labs/reya-off-chain-monorepo (tracked in Reya-Labs/reya-off-chain-monorepo#2575).

Scoped to PRs 1–7 (additive, non-breaking). PR 8 (AMM cleanup) will ship as a separate, breaking spec bump once the on-chain AMM is fully deprecated.

Changes

  • NEW unified execution-bust REST endpoints (GET /market/{symbol}/executionBusts, GET /wallet/{address}/executionBusts)
  • NEW unified execution-bust WS channels (/v2/market/{symbol}/executionBusts, /v2/wallet/{address}/executionBusts)
  • NEW shared schemas ExecutionBust, ExecutionBustList (structural clones of the spot variants; no marketType field — clients can derive spot vs perp from the symbol suffix)
  • Semantic-only documentation updates on /createOrder, /cancelOrder, /cancelAll, /market/{symbol}/depth to reflect perp support (no schema changes)
  • Version bump: 2.1.92.2.0 in both openapi and asyncapi files
  • Docs: docs/asyncapi-trading-v2-docs.md updated with the two new channel sections + ExecutionBust data type block

Links

  • Parent issue: Reya-Labs/reya-off-chain-monorepo#2575
  • Foundation: Reya-Labs/reya-off-chain-monorepo#2576 (V3 types/ABIs/schema/config)
  • Busts E2E: Reya-Labs/reya-off-chain-monorepo#2584
  • Mark price/FR E2E: Reya-Labs/reya-off-chain-monorepo#2585 (WS channels deferred to a separate spec bump)
  • Perp executions V3: Reya-Labs/reya-off-chain-monorepo#2586
  • SDK: Reya-Labs/reya-off-chain-monorepo#2587
  • Order entry: Reya-Labs/reya-off-chain-monorepo#2588
  • Depth & orderChanges: Reya-Labs/reya-off-chain-monorepo#2589

NOTE: This spec PR ships independently. The backend REST handlers for GET /market/{symbol}/executionBusts and GET /wallet/{address}/executionBusts do not yet exist in the off-chain monorepo; they are captured as a P1 TODO on the parent issue for a backend agent to pick up.

What this PR is NOT doing (and why)

  • Not removing poolPrice / throttledPoolPrice / fundingPnl / openingFee / realizedPnl / priceVariationPnl — these are removed in Reya-Labs/reya-off-chain-monorepo#2590 (PR 8, AMM cleanup), which only ships after on-chain AMM deprecation. Keeping the fields preserves backward compatibility during the transition.
  • Not exposing the V3 perp execution fee breakdown (protocolFeeCredit, exchangeFeeCredit, makerFeeCredit, makerFeeDebit, referrerFeeCredit) — these live in the DB but are not yet surfaced by transformTrade (Known Gap H3 on the parent issue). Will follow as a separate spec bump once the backend transformer is updated.
  • Not adding /v2/market/{symbol}/markPrice or /v2/market/{symbol}/fundingRate WS channels — payload shape is still TBD per author TODO in packages/bun-socket/lib.ts. Follow-up item on the parent issue.
  • Not exposing more granular liquidation subtypes (DUTCH_LIQUIDATION, RANKED_LIQUIDATION, BACKSTOP_LIQUIDATION) — transformTrade currently collapses all liquidations to 'LIQUIDATION'. Follow-up item on the parent issue.

Test plan

  • npx @redocly/cli bundle openapi-trading-v2.yaml — bundles cleanly
  • npx @asyncapi/cli bundle asyncapi-trading-v2.yaml — bundles cleanly
  • npx @asyncapi/cli validate asyncapi-trading-v2.yaml — 0 errors, 0 warnings (only the pre-existing info notice about AsyncAPI 3.1.0)
  • trading-schemas.json parses as valid JSON; ExecutionBust + ExecutionBustList present; SpotExecutionBust preserved
  • @redocly/cli lint error count matches main except for the 4 new errors from the pre-existing security-defined rule on the 2 new endpoints + 2 schema entries (consistent with repo convention)
  • End-to-end sanity once the backend REST handlers land (see P1 TODO on #2575): GET /v2/market/BTCRUSDPERP/executionBusts validates against ExecutionBustList; WS subscription to /v2/market/BTCRUSDPERP/executionBusts receives a bust matching MarketExecutionBustUpdatePayload
  • SDK smoke test: bump the submodule in reya-python-sdk, regenerate the client, confirm ExecutionBust, ExecutionBustList, get_market_execution_busts, get_wallet_execution_busts are generated

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added real-time subscription channels for execution bust updates at market and wallet levels
    • Added REST API endpoints to query execution busts with time-range filtering capabilities
    • Introduced ExecutionBust data schema with detailed failed fill information
  • Documentation

    • Enhanced order API documentation to clarify support for both spot and perp markets

Documents the public REST + WebSocket surface for unified (spot + perp)
execution busts introduced by the feat/perpOB migration in
Reya-Labs/reya-off-chain-monorepo#2575. Scoped to the additive surface
of PRs 1–7; PR 8's breaking AMM cleanup will ship as a later spec bump.

- trading-schemas.json: new ExecutionBust + ExecutionBustList schemas
  (structural clones of the spot variants; no marketType field, since
  clients can derive spot vs perp from the symbol suffix)
- openapi-trading-v2.yaml: new GET /market/{symbol}/executionBusts and
  GET /wallet/{address}/executionBusts; components.schemas aliases;
  description tweaks on /depth, /createOrder, /cancelOrder, /cancelAll
  to reflect perp support; version 2.1.9 → 2.2.0
- asyncapi-trading-v2.yaml: new marketExecutionBusts + walletExecutionBusts
  channels, receive* operations, Market/WalletExecutionBustUpdate messages,
  channel patterns, body + payload schemas; version 2.1.9 → 2.2.0
- docs/asyncapi-trading-v2-docs.md: channel list entries + full sections
  for the two new WS channels with ExecutionBust data type block

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 17917835-10bc-4c87-b0a1-2a3513e9e474

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Version bumped to 2.2.0. Added two new WebSocket subscription channels (marketExecutionBusts and walletExecutionBusts) and two corresponding REST endpoints for querying real-time and historical execution busts. Introduced associated message definitions, payload schemas, and data structures (ExecutionBust, ExecutionBustList).

Changes

Cohort / File(s) Summary
WebSocket Channels
asyncapi-trading-v2.yaml, docs/asyncapi-trading-v2-docs.md
Added two new subscription channels: /v2/market/{symbol}/executionBusts and /v2/wallet/{address}/executionBusts. Introduced MarketExecutionBustUpdate and WalletExecutionBustUpdate messages with corresponding payloads and channel-pattern validation schemas. Updated version from 2.1.9 to 2.2.0.
REST Endpoints
openapi-trading-v2.yaml
Added GET /market/{symbol}/executionBusts and GET /wallet/{address}/executionBusts endpoints with query parameters for time range filtering. Updated endpoint descriptions for market depth and order operations to clarify spot/perp support.
Data Schemas
trading-schemas.json
Added ExecutionBust and ExecutionBustList schema definitions to model execution bust data with required fields (symbol, accountId, orderId, qty, side, price, reason, timestamp) and pagination metadata.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Server
    participant DataStore as Data Store

    rect rgba(76, 175, 80, 0.5)
    Note over Client,Server: WebSocket Subscription Flow
    Client->>Server: Subscribe to /v2/market/{symbol}/executionBusts
    Server->>Server: Register subscription
    Note over Server: Execution bust occurs
    Server->>Client: Publish MarketExecutionBustUpdate
    end

    rect rgba(33, 150, 243, 0.5)
    Note over Client,DataStore: REST Query Flow
    Client->>Server: GET /market/{symbol}/executionBusts?startTime=X&endTime=Y
    Server->>DataStore: Fetch execution busts in time range
    DataStore-->>Server: Return ExecutionBust records
    Server-->>Client: Return ExecutionBustList (paginated response)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • tomdevman
  • danigr99727
  • 0xZenus

Poem

🐰 When busts occur and fills fall through,
New channels spring to tell the news,
Both market whispers, wallet views,
In real-time streams and REST calls too,
Execution tales for me and you!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat: perpOB support' is vague and generic, using only an abbreviation without clearly conveying what perpOB is or what specific changes are being made to support it. Use a more descriptive title that captures the primary change, such as 'feat: add execution-bust REST and WebSocket endpoints' or 'feat: add perpOB execution-bust endpoints and schemas'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/perpOB

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.2.0

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/asyncapi-trading-v2-docs.md (1)

596-947: ⚠️ Potential issue | 🟡 Minor

Fix markdownlint spacing regressions in the new executionBusts sections.

Line 596 and Line 903 headings, plus nearby fenced blocks (Line 603, Line 611, Line 910, Line 918), are missing required surrounding blank lines (MD022/MD031).

🧹 Suggested markdown spacing fix
 #### `/v2/market/{symbol}/executionBusts`
+
 **Purpose**: Real-time execution busts (failed fills) for a specific market, covering both spot and perp
 
 **Parameters**:
 - `symbol`: Trading symbol (e.g., `BTCRUSDPERP`, `ETHRUSD`). Clients can distinguish spot vs perp entries from the suffix (`*RUSDPERP` for perp, `*RUSD` for spot)
 
 **Subscription**:
+
 ```json
 {
   "type": "subscribe",
   "channel": "/v2/market/BTCRUSDPERP/executionBusts"
 }

Message Structure:
+

{
  "type": "channel_data",
@@
}

@@

/v2/wallet/{address}/executionBusts

Purpose: Real-time execution bust updates (failed fills) for a wallet, covering both spot and perp

Parameters:

  • address: Ethereum wallet address

Subscription:
+

{
  "type": "subscribe",
  "channel": "/v2/wallet/0x6c51275fd01d5dbd2da194e92f920f8598306df2/executionBusts"
}

Message Structure:
+

{
  "type": "channel_data",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/asyncapi-trading-v2-docs.md` around lines 596 - 947, The markdown is
failing MD022/MD031 due to missing blank lines around headings and fenced code
blocks in the new executionBusts sections; fix by adding a single blank line
before and after the "#### `/v2/market/{symbol}/executionBusts`" heading and its
surrounding fenced json blocks (the subscription block and the message-structure
```json``` block) and likewise add blank lines before and after the "####
`/v2/wallet/{address}/executionBusts`" heading and its subscription and
message-structure fenced blocks so each heading and fenced code block is
separated by an empty line; locate these sections by the unique headings
`/v2/market/{symbol}/executionBusts` and `/v2/wallet/{address}/executionBusts`
and adjust spacing accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@openapi-trading-v2.yaml`:
- Around line 389-413: The new public operation getMarketExecutionBusts (path
/market/{symbol}/executionBusts) is exposed before backend handlers exist—either
block merge until handlers are implemented or mark the operation as
rollout-pending: update the operation (operationId: getMarketExecutionBusts) to
add an availability note in the description stating "rollout-pending" and add a
temporary '501' response (e.g., reference a components/responses/NotImplemented
or create one) so clients receive a clear 501 until handlers are live; apply the
same change for the other pending endpoint referenced in the PR (the one around
line 482) to keep the contract consistent.

---

Outside diff comments:
In `@docs/asyncapi-trading-v2-docs.md`:
- Around line 596-947: The markdown is failing MD022/MD031 due to missing blank
lines around headings and fenced code blocks in the new executionBusts sections;
fix by adding a single blank line before and after the "####
`/v2/market/{symbol}/executionBusts`" heading and its surrounding fenced json
blocks (the subscription block and the message-structure ```json``` block) and
likewise add blank lines before and after the "####
`/v2/wallet/{address}/executionBusts`" heading and its subscription and
message-structure fenced blocks so each heading and fenced code block is
separated by an empty line; locate these sections by the unique headings
`/v2/market/{symbol}/executionBusts` and `/v2/wallet/{address}/executionBusts`
and adjust spacing accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 32852e20-51cc-473e-9ba6-27162d6064b5

📥 Commits

Reviewing files that changed from the base of the PR and between bc6f24d and 6636448.

📒 Files selected for processing (4)
  • asyncapi-trading-v2.yaml
  • docs/asyncapi-trading-v2-docs.md
  • openapi-trading-v2.yaml
  • trading-schemas.json

Comment thread openapi-trading-v2.yaml
Comment thread trading-schemas.json Outdated
Aligns PerpExecution with SpotExecution by adding order ID and
counterparty fields. All three are optional to maintain backward
compatibility with legacy V2 executions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.2.0

Comment thread trading-schemas.json Outdated
@arturbeg arturbeg changed the title feat: add unified execution-bust REST + WS endpoints for perpOB feat: perpOB support Apr 14, 2026
Remove longOiQty, shortOiQty, fundingRateVelocity fields and rename
throttledOraclePrice to throttledMarkPrice, throttledPoolPrice to
throttledMidPrice.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.2.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.2.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.2.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.2.0

@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.2.0

@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.3.0

@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.3.0

arturbeg and others added 2 commits April 20, 2026 14:42
Aligns REST property, EIP-712 typehash, docs and field table with the
on-chain rename (reya-network feat/perpOB@0dd62068 renamed
OrderDetails.orderExpiry -> expiresAfter). No semantic change; breaking
name change only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.3.0

@danigr99727

Copy link
Copy Markdown
Collaborator

apr 20th: lgtm

Comment thread trading-schemas.json Outdated
Drops the "assumes perp for backwards compatibility" fallback on
CancelOrderRequest and makes symbol explicit on both request schemas so
clients can no longer rely on implicit market inference.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.3.0

@danigr99727

Copy link
Copy Markdown
Collaborator

LGTM, but there are conflicts

Comment thread docs/eip712.md Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@arturbeg all docs should be in the new reya-doc repo https://github.com/Reya-Labs/reya-docs/

@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.3.0

# Conflicts:
#	asyncapi-trading-v2.yaml
#	openapi-trading-v2.yaml
@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

Version mismatch detected!

  • OpenAPI version: 2.3.0
  • AsyncAPI version: 2.3.0
  • ws-exec AsyncAPI version: 2.2.1

⚠️ Please ensure all three specs have the same version.

# Conflicts:
#	asyncapi-trading-v2.yaml
#	openapi-trading-v2.yaml
@github-actions

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 2.3.0

arturbeg and others added 3 commits May 26, 2026 11:47
…sAfter (#46)

* docs(ws-exec): clarify EIP-712 envelope field is deadline, not expiresAfter

The asyncapi-exec-v2.yaml description listed `expiresAfter` as one of
the per-message EIP-712 signature fields, but on feat/perpOB the signed
envelope deadline is `deadline` (sig validity, server-enforced at entry)
while `expiresAfter` carries `OrderDetails.orderExpiry` (order lifetime,
on-chain enforced) and only appears on `createOrder` payloads.

Doc-only change: no schemas updated, no generated types affected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: bump API specs version to 2.3.1

* docs(ws-exec): drop stale spot-only / no-perp-mass-cancel claim from sendCancelAll

On feat/perpOB the off-chain mass-cancel handler dispatches both spot
and perp through the matching engine via the unified `marketId`
namespace (perpOB design). The asyncapi-exec-v2.yaml description was
inherited from main, where the matching engine was spot-only and perp
mass-cancel went through a different path; that claim is no longer
accurate.

The REST counterpart (`openapi-trading-v2.yaml`, /cancelAll) already
documents this as supporting both spot and perp — bringing the WS spec
in line.

Doc-only change: no schemas updated, no generated types affected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: GitHub Action <action@github.com>
Realigns the in-file version with the git tag sequence on feat/perpOB.
Prior tag at `dadfebf` is `2.3.2`; in-file version was at `2.3.1`
(auto-bumped from `2.3.0` during PR #46). Bumping straight to `2.3.3`
to skip the conflicting `2.3.2` slot.

No schema changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reconcile main into the perpOB feature branch ahead of PR #35.

Conflict resolution:
- version: set to 3.0.0 across all three spec files. The 2.3.x tags already
  exist (auto-bumps on feat/perpOB), so 3.0.0 starts a fresh line and lets
  post-merge-tag cut a clean tag + release on merge to main.
- StartTimeParam / EndTimeParam descriptions: kept main's corrected wording
  (inclusive bounds, on-chain block timestamp, "capped at a maximum that
  varies by endpoint" from #36/#48), dropping feat/perpOB's stale
  "sequence number" text.

Validated: redocly bundle (openapi) clean; asyncapi validate trading + exec
0 errors; trading-schemas.json parses.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 3.0.0

Re-reconcile after main advanced to 2.3.4 (#50, PRO-107 version bump).
Conflict: version line only — kept 3.0.0 across all three spec files
(higher than 2.3.4, no tag collision). Descriptions + perp* aliases
auto-merged cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 3.0.0

arturbeg and others added 2 commits June 4, 2026 19:41
…52)

* feat(order): add postOnly to CreateOrderRequest and GTT to TimeInForce

The on-chain OrderDetails struct gained a postOnly field (after reduceOnly) and
TimeInForce gained GTT. Surface both in the shared trading schema so the REST
createOrder body and the ws-exec createOrder frame (which $refs CreateOrderRequest)
carry postOnly, and clients can request GTT.

- CreateOrderRequest: add optional postOnly (boolean; maker-only, valid on
  GTC/GTT, rejected on IOC) after reduceOnly.
- TimeInForce enum: add GTT (maps to on-chain timeInForce = 2).
- Clarify the expiresAfter rule: GTC/IOC use 0; only GTT sets a non-zero
  expiresAfter, which must exceed the deadline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: bump API specs version to 3.0.1

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: GitHub Action <action@github.com>
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 3.0.1

… GitBook render) (#53)

* fix(spec): strip invalid $id / x-parser-schema-id from trading-schemas.json

The served OpenAPI bundle carried 48 `$id` keys (e.g. `$id: '#MarketDefinition'`),
inlined from trading-schemas.json by the redocly bundle step. `$id` is invalid in
OpenAPI 3.0 schema objects (an AsyncAPI-parser artifact) and breaks GitBook's
published renderer: it silently drops operations whose response schema carries a
`$id`. Concretely `/perpMarketDefinitions` (an alias of the deprecated
`/marketDefinitions`, sharing the `MarketDefinition` schema) disappears from the
published REST reference while still showing in the editor. GitBook flags all 48
as "Property $id is not expected to be here".

- Strip `$id` + `x-parser-schema-id` from all 50 definitions (101 line-deletions).
  Safe: refs are path-based (`#/definitions/...`), not `$id`-based; pure-deletion
  diff, valid JSON, all paths + schemas intact, bundle now has 0 `$id`.
- Add `.github/workflows/lint-spec.yml`: bundles the spec and asserts the bundle
  has no `$id` (regression guard) + `redocly lint` (informational). The existing
  CI only version-bumps/tags and never validated the spec.

Refs PRO-216.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: bump API specs version to 3.0.2

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: GitHub Action <action@github.com>
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 3.0.2

Comment on lines +26 to +52
name: Lint API Specs
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

# Pinned to the same redocly version the off-chain `build:specs` step uses
# to produce the served bundle, so this reproduces what GitBook ingests.
- name: Bundle OpenAPI spec
run: npx --yes @redocly/cli@2.0.8 bundle openapi-trading-v2.yaml -o /tmp/openapi-bundled.yaml

- name: Assert bundle has no `$id` keys (invalid in OpenAPI 3.0; breaks GitBook)
run: |
if grep -nE '^[[:space:]]*\$id:' /tmp/openapi-bundled.yaml; then
echo "::error::Bundled OpenAPI contains \$id keys. They are invalid in OpenAPI 3.0 schema objects and break GitBook's published renderer (it drops operations). Strip \$id / x-parser-schema-id from trading-schemas.json."
exit 1
fi
echo "OK - no \$id keys in the bundled spec."

- name: redocly lint (informational)
continue-on-error: true
run: npx --yes @redocly/cli@2.0.8 lint openapi-trading-v2.yaml
Removes the deprecated /marketDefinitions path so /perpMarketDefinitions (now the sole owner of the MarketDefinition schema) renders in GitBook; converts plural `examples` -> `example` to clear OpenAPI 3.0 anomalies. Route still works on the API for back-compat.
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🤖 API Specs Version Check

📝 Manual version changes detected

✅ Version consistency verified: 3.0.3

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