Skip to content
Merged
9 changes: 9 additions & 0 deletions open-api/rest-catalog-open-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ class Namespace(BaseModel):
)


class PageToken(BaseModel):
__root__: str = Field(
...,
description='An opaque token which allows clients to make use of pagination for a list API (e.g. ListTables). Clients will initiate the first paginated request by sending an empty pageToken e.g. GET /tables?pageToken or GET /tables?pageToken= signaling to the service that the response should be paginated.\nFor servers that support pagination, they will recognize `pageToken` and return a next-page-token in response if there are more results available. After the initial request, it is expected that the next-page-token from the last response, is used in the subsequent request. For servers that do not support pagination, they will ignore the `pageToken` and return all results.',
)


class TableIdentifier(BaseModel):
namespace: Namespace
name: str
Expand Down Expand Up @@ -581,10 +588,12 @@ class GetNamespaceResponse(BaseModel):


class ListTablesResponse(BaseModel):
next_page_token: Optional[PageToken] = Field(None, alias='next-page-token')
identifiers: Optional[List[TableIdentifier]] = Field(None, unique_items=True)


class ListNamespacesResponse(BaseModel):
next_page_token: Optional[PageToken] = Field(None, alias='next-page-token')
namespaces: Optional[List[Namespace]] = Field(None, unique_items=True)


Expand Down
41 changes: 41 additions & 0 deletions open-api/rest-catalog-open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ paths:
If `parent` is not provided, all top-level namespaces should be listed.
operationId: listNamespaces
parameters:
- $ref: '#/components/parameters/page-token'
- $ref: '#/components/parameters/page-size'
- name: parent
in: query
description:
Expand Down Expand Up @@ -448,6 +450,9 @@ paths:
summary: List all table identifiers underneath a given namespace
description: Return all table identifiers under this namespace
operationId: listTables
parameters:
- $ref: '#/components/parameters/page-token'
- $ref: '#/components/parameters/page-size'
responses:
200:
$ref: '#/components/responses/ListTablesResponse'
Expand Down Expand Up @@ -1070,6 +1075,9 @@ paths:
summary: List all view identifiers underneath a given namespace
description: Return all view identifiers under this namespace
operationId: listViews
parameters:
- $ref: '#/components/parameters/page-token'
- $ref: '#/components/parameters/page-size'
responses:
200:
$ref: '#/components/responses/ListTablesResponse'
Expand Down Expand Up @@ -1482,6 +1490,24 @@ components:
explode: false
example: "vended-credentials,remote-signing"

page-token:
name: pageToken
in: query
required: false
allowEmptyValue: true
schema:
$ref: '#/components/schemas/PageToken'

page-size:
name: pageSize
in: query
description:
For servers that support pagination, this signals an upper bound of the number of results that a client will receive.
For servers that do not support pagination, clients may receive results larger than the indicated `pageSize`.
required: false
schema:
type: integer

##############################
# Application Schema Objects #
##############################
Expand Down Expand Up @@ -1581,6 +1607,17 @@ components:
type: string
example: [ "accounting", "tax" ]

PageToken:
description:
An opaque token which allows clients to make use of pagination for a list API (e.g. ListTables).
Clients will initiate the first paginated request by sending an empty pageToken e.g. GET /tables?pageToken or GET /tables?pageToken=
signaling to the service that the response should be paginated.

For servers that support pagination, they will recognize `pageToken` and return a next-page-token in response if there are more results available.
After the initial request, it is expected that the next-page-token from the last response, is used in the subsequent request.
For servers that do not support pagination, they will ignore the `pageToken` and return all results.
type: string

TableIdentifier:
type: object
required:
Expand Down Expand Up @@ -3169,6 +3206,8 @@ components:
ListTablesResponse:
type: object
properties:
next-page-token:
$ref: '#/components/schemas/PageToken'
identifiers:
type: array
uniqueItems: true
Expand All @@ -3178,6 +3217,8 @@ components:
ListNamespacesResponse:
type: object
properties:
next-page-token:
$ref: '#/components/schemas/PageToken'
namespaces:
type: array
uniqueItems: true
Expand Down