Latitude 10 docs

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
FieldWhat it does
nameThe method's name, in place of the operationId.
groupThe resource the method goes in, in place of the operation's first tag.
excludetrue 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: $.data
typeAlso needs
cursorcursorParam, a query parameter, and nextCursor, a path in the response.
offsetoffsetParam and limitParam, two different query parameters.
pagepageParam, 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.ts
  • app/sdk/_lib/names.ts
  • tests/fixtures/sdk/