Skip to content

Commit 8f20de8

Browse files
authored
docs(api): define v2 list and lookup contracts (#3169)
* docs(api): define v2 list and lookup contracts * docs(api): deprecate legacy v2 paginator
1 parent 12fd402 commit 8f20de8

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

  • src/dashboard/apigateway/apigateway/apis

src/dashboard/apigateway/apigateway/apis/AGENTS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ Open and v2 automation surfaces use the normalized stored protocol instead.
4545
Masked-secret restoration is a Web update-boundary behavior; do not apply it to
4646
Open or Sync input, where submitted stored-protocol values are literal.
4747

48+
## V2 List And Lookup Contracts
49+
50+
- Keep collection listing and exact batch lookup as separate APIs under
51+
`apis.v2`. A list API serves discovery and filtering on the collection route;
52+
when callers need exact batch retrieval by identifiers such as `ids` or
53+
`names`, add a non-paginated `-/lookup/` route that returns `data: [...]`.
54+
Do not add an identifier-list mode to a list API that changes its normal
55+
visibility, filtering, or pagination semantics.
56+
- List APIs use the standard `limit`/`offset` pagination contract and return
57+
`data: {"count": <int>, "results": [...]}`.
58+
- `apigateway.utils.paginator.LimitOffsetPaginator` is deprecated for
59+
`apis.v2`; do not use it in new or modified v2 endpoints. Use the configured
60+
`apigateway.common.pagination.StandardLimitOffsetPagination` (or a
61+
surface-specific subclass) through `self.paginate_queryset(...)` and
62+
`self.get_paginated_response(...)` instead. Do not hand-build the envelope
63+
when the view owns an unpaginated queryset or list. When a downstream source
64+
already applies `limit`/`offset` and supplies the total count, preserve the
65+
same standard response envelope without paginating the page again.
66+
4867
## OpenAPI Contract
4968

5069
When changing an open API, keep these representations aligned:

0 commit comments

Comments
 (0)