feat(management): endpoint schemas + facilitator/x402Version on createApi#8
Open
TheRealAlexandre wants to merge 3 commits into
Open
Conversation
Extend CreateApiInput and ApiEndpointInput so callers can describe each endpoint's query/path/header parameters and request body schema — or pass a full OpenAPI 3.x spec via the new `openApi` field. Without this, APIs created through the Management API appear in the marketplace with no testable inputs because the UI has no schema to render.
Expose optional facilitator and x402Version fields on CreateApiInput (already accepted server-side) so TypeScript callers can pick the settlement facilitator per API. Defaults to the first supported facilitator on the network and the newest x402 version the pair supports. Server rejects unsupported (facilitator, network, version) triples.
Reflect the server-side default resolution: createApi without an explicit facilitator uses relai whenever the network supports it (every network except peaq and sei) and x402Version defaults to 2 wherever the pair supports v2. No code change — JSDoc only.
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.
Summary
Fill in the remaining gaps in the Management API TypeScript types so every field the server already accepts is reachable from the SDK — and APIs created through the SDK show up in the marketplace with fully populated test forms.
1. Endpoint schemas (commit
a39dc09)Without schema info, the marketplace Test tab renders no inputs. Callers now have three ergonomic options (any one is enough):
parameters— OpenAPI Parameter Objects (query / path / header), with full field preservation (schema,style,example,deprecated, ...).requestBody— full OpenAPI shape ({ content: { 'application/json': { schema } } }) or simplified inner-schema shape ({ required: [...], properties: {...} }).openApionCreateApiInput— pass a full OpenAPI 3.x document (object or JSON string). Ifendpointsis omitted, endpoints are derived from the spec's paths with a default price.New types:
OpenApiParameter,OpenApiRequestBody.2. Facilitator & x402Version (commit
ba85de1)facilitatorandx402Versionwere accepted server-side but not typed. Expose them onCreateApiInput, export aFacilitatorunion (with a(string & {})escape hatch so new facilitators don't break builds) and anX402Version = 1 | 2alias. Server still validates the(facilitator, network, version)triple against its support matrix.No breaking changes — every new field is optional.
Usage
Test plan
npx tsc --noEmitpasses (verified).parametersrenders query inputs on the marketplace test tab.requestBody(simplified shape) renders the body form.openApispec — endpoints auto-derived, schemas available.facilitator: 'relai'withnetwork: 'skale-base'accepted;facilitator: 'dexter'withnetwork: 'skale-base'rejected with 400.