feat(core): openapi schema for hosted-mode enrichment fields (v2.49.1)#978
Merged
Conversation
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.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
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.
Brings
core/src/server/openapi.yamland the auto-generateddocs/api-reference/openapi.jsonin 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
txHash,chain,blockNumberrequiredtrimmed from[marketId, outcomeId, outcomeLabel, size, entryPrice, currentPrice, unrealizedPnL]to[marketId, outcomeId, size](the other four became optional in 2.49.0). + newcurrentValuefield.venueexpiry{message}to full envelope{message, code (24-value enum), retryable, exchange?, detail?}pmxtApiKey,walletAddress,signer,privateKey,baseUrl,apiKey,autoStartServer)How
Both
openapi.yamlandopenapi.jsonregenerated vianode core/scripts/generate-openapi.js. Source edits incore/src/types.ts+ the generator script itself (AST extractor now emitsnullable: trueforT | nullunions; static schemas expanded).Tests
npx tsc --noEmitcleannpm test9/9 pass on openapi/schema/types subset