Skip to content

feat(core): openapi schema for hosted-mode enrichment fields (v2.49.1)#978

Merged
realfishsam merged 1 commit into
mainfrom
core/openapi-hosted-trading-fields
Jun 8, 2026
Merged

feat(core): openapi schema for hosted-mode enrichment fields (v2.49.1)#978
realfishsam merged 1 commit into
mainfrom
core/openapi-hosted-trading-fields

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Brings core/src/server/openapi.yaml and the auto-generated docs/api-reference/openapi.json in line with v2.49.0. SDK models (Python + TypeScript) were updated in 2.49.0; the schemas were stale and downstream codegen consumers missed the new hosted-mode fields.

Schema changes

  • Order / UserTrade / Position: + nullable txHash, chain, blockNumber
  • Position: required trimmed from [marketId, outcomeId, outcomeLabel, size, entryPrice, currentPrice, unrealizedPnL] to [marketId, outcomeId, size] (the other four became optional in 2.49.0). + new currentValue field.
  • Balance: + nullable venue
  • BuiltOrder: + nullable expiry
  • ErrorDetail: expanded from {message} to full envelope {message, code (24-value enum), retryable, exchange?, detail?}
  • ExchangeOptions: new component schema (pmxtApiKey, walletAddress, signer, privateKey, baseUrl, apiKey, autoStartServer)

How

Both openapi.yaml and openapi.json regenerated via node core/scripts/generate-openapi.js. Source edits in core/src/types.ts + the generator script itself (AST extractor now emits nullable: true for T | null unions; static schemas expanded).

Tests

  • npx tsc --noEmit clean
  • npm test 9/9 pass on openapi/schema/types subset

Bring core/src/server/openapi.yaml and the auto-generated
docs/api-reference/openapi.json in line with v2.49.0. SDK models
(python + typescript) were updated in the v2.49.0 release; the
schemas were stale and downstream codegen consumers missed the
new hosted-mode fields.

core/src/types.ts:
- Order/UserTrade/Position: + nullable txHash, chain, blockNumber
- Position: flip outcomeLabel/entryPrice/currentPrice/unrealizedPnL
  to optional+nullable; + new currentValue field
- Balance: + nullable venue
- BuiltOrder: + nullable expiry

core/scripts/generate-openapi.js:
- AST extractor emits nullable: true for T | null unions (previously
  dropped because TS parses `null` inside a union as a LiteralType
  wrapping NullKeyword, not bare NullKeyword)
- STATIC_SCHEMAS.ErrorDetail expanded from {message} to full envelope
  with code (24-value enum), retryable, exchange, detail
- STATIC_SCHEMAS.ExchangeOptions added (pmxtApiKey, walletAddress,
  signer, privateKey, baseUrl, apiKey, autoStartServer)

core/src/exchanges/mock/index.ts:
- Null-safety fallback (existing.entryPrice ?? price) required by
  TS strict-null-checks now that Position.entryPrice is nullable

core/src/server/openapi.yaml + docs/api-reference/openapi.json
regenerated via node core/scripts/generate-openapi.js. Both files
are produced from the same generator pass so they stay in sync.

Tests: npx tsc --noEmit clean; npm test 9/9 pass on openapi/schema/
types subset.
@mintlify

mintlify Bot commented Jun 8, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
PMXT 🟢 Ready View Preview Jun 8, 2026, 8:02 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@realfishsam realfishsam merged commit eb9b27b into main Jun 8, 2026
11 of 15 checks passed
@realfishsam realfishsam deleted the core/openapi-hosted-trading-fields branch June 8, 2026 20:13
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.

1 participant