OpenAPI extensions for SDKs
The generator reads two extensions on an operation, both ours. Other vendors' x- keys aren't read.
x-latitude10-sdk
x-latitude10-sdk names and groups an operation's method:
paths:
/orders:
get:
operationId: listOrders
x-latitude10-sdk:
name: list
group: orders| Field | What it does |
|---|---|
name | The method's name, in place of the operationId. |
group | The resource the method goes in, in place of the operation's first tag. |
exclude | true leaves the operation out of the SDK. |
Without it, a method is named from the operationId, or else from its method and path, and grouped by its first tag.
x-latitude10-pagination
x-latitude10-pagination declares how an operation pages, so its method can walk every page:
x-latitude10-pagination:
type: cursor
cursorParam: cursor
nextCursor: $.next_cursor
items: $.datatype | Also needs |
|---|---|
cursor | cursorParam, a query parameter, and nextCursor, a path in the response. |
offset | offsetParam and limitParam, two different query parameters. |
page | pageParam, a query parameter. |
Every type needs items, the path of the list in the response, such as $.data. A declaration that's missing something leaves the operation unpaginated, with a warning in GENERATION.md saying what.
Detected without the extension
Only one common shape is detected, never guessed: a query parameter named cursor, after, starting_after or page_token, and a response object with exactly one array property and either a next_cursor or next_page_token field, or a has_more field with items that have an id, the last of which is the next cursor.
Where this comes from
app/sdk/_lib/model.tsapp/sdk/_lib/names.tstests/fixtures/sdk/