-
-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Add opaque pagination #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
cc0b845
dffef69
09e6299
13633f5
4a34e6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # $schema: https://spec.openapis.org/oas/3.1/schema-base/2025-02-13 | ||
| open# $schema: https://spec.openapis.org/oas/3.1/schema-base/2025-02-13 | ||
| openapi: 3.1.1 | ||
| jsonSchemaDialect: https://spec.openapis.org/oas/3.1/dialect/base | ||
| info: | ||
|
|
@@ -157,10 +157,10 @@ paths: | |
| match. | ||
| operationId: queryTeaProducts | ||
| parameters: | ||
| - $ref: "#/components/parameters/page-offset" | ||
| - $ref: "#/components/parameters/page-size" | ||
| - $ref: "#/components/parameters/id-type" | ||
| - $ref: "#/components/parameters/id-value" | ||
| - $ref: "#/components/parameters/page-token" | ||
| - $ref: "#/components/parameters/sort-field-product" | ||
| - $ref: "#/components/parameters/sort-order" | ||
| responses: | ||
| '200': | ||
| $ref: "#/components/responses/paginated-product" | ||
|
|
@@ -1468,26 +1468,14 @@ components: | |
| pagination-details: | ||
| type: object | ||
| properties: | ||
| timestamp: | ||
| nextPageToken: | ||
| type: string | ||
| format: date-time | ||
| example: '2024-03-20T15:30:00Z' | ||
| pageStartIndex: | ||
| type: integer | ||
| format: int64 | ||
| default: 0 | ||
| pageSize: | ||
| type: integer | ||
| format: int64 | ||
| default: 100 | ||
| totalResults: | ||
| type: integer | ||
| format: int64 | ||
| nullable: true | ||
| description: | | ||
| A token to retrieve the next page. If this field is omitted or empty, | ||
| there are no more pages to retrieve. | ||
|
madpah marked this conversation as resolved.
Outdated
|
||
| required: | ||
| - timestamp | ||
| - pageStartIndex | ||
| - pageSize | ||
| - totalResults | ||
| - nextPageToken | ||
|
|
||
| paginated-product-response: | ||
| type: object | ||
|
|
@@ -1568,7 +1556,16 @@ components: | |
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: "#/components/schemas/paginated-product-response" | ||
| type: object | ||
| description: A paginated response containing TEA Products | ||
| allOf: | ||
| - $ref: "#/components/schemas/pagination-details" | ||
| - type: object | ||
| properties: | ||
| results: | ||
| type: array | ||
| items: | ||
| $ref: "#/components/schemas/product" | ||
| paginated-product-release: | ||
| description: A paginated response containing TEA Product Releases | ||
| content: | ||
|
|
@@ -1589,24 +1586,49 @@ components: | |
| $ref: "#/components/schemas/paginated-component-release-response" | ||
| parameters: | ||
| # Pagination | ||
| page-offset: | ||
| name: pageOffset | ||
| description: Pagination offset | ||
| page-size: | ||
| name: pageSize | ||
| description: The maximum number of results to return. | ||
| in: query | ||
| required: false | ||
| schema: | ||
| type: integer | ||
| format: int64 | ||
| default: 0 | ||
| page-size: | ||
| name: pageSize | ||
| description: Pagination offset | ||
| minimum: 1 | ||
| maximum: 100 | ||
| default: 25 | ||
| page-token: | ||
| name: pageToken | ||
| description: | | ||
| An opaque token used to retrieve the next page of results. | ||
| This should be copied exactly from the `nextPageToken` field of a previous response. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we define how For cursor/token pagination, clients need to know whether For example, if the first request uses:
and the next request sends:
what should the server do? Possible options:
I think the spec should choose one behavior before v1.0 to avoid incompatible implementations. Defining this behavior now will ensure forward compatibility and consistent behavior across different TEA server implementations. |
||
| in: query | ||
| required: false | ||
| schema: | ||
| type: integer | ||
| format: int64 | ||
| default: 100 | ||
| type: string | ||
| sort-order: | ||
| name: sortOrder | ||
| description: The direction of the sort. | ||
| in: query | ||
| required: false | ||
| schema: | ||
| type: string | ||
| enum: | ||
| - asc | ||
| - desc | ||
| default: asc | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed sortOrder defaults to asc globally. Would it be worth considering resource-specific defaults instead? For security-related resources like product/component releases (often sorted by createdDate) or collections (sorted by version), consumers typically expect the most recent data first (newest-to-oldest). If a universal asc default is preferred for simplicity, perhaps we could add a small note in the description to help set expectations for implementers/consumers. |
||
| # Pagination Sort Fields per TEA Object Type | ||
| sort-field-product: | ||
| name: sortField | ||
| description: The field by which to sort the results. | ||
| in: query | ||
| required: false | ||
| schema: | ||
| type: string | ||
| enum: | ||
| - name | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sort-field-component: and sort-field-product: If If names are not guaranteed to be unique, token pagination still needs a deterministic secondary ordering, such as UUID. If names are intended to be unique, that constraint should probably be documented in the corresponding product/component schema descriptions. |
||
| default: name | ||
|
|
||
| # | ||
| # Query by identifier | ||
| # | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.