Skip to content

GL-335: Consistent cursor pagination + fix OpenAPI list response contract #42

Description

@discodone

Review source

Round 14 (Gemini) — API Design 6/10, top blocker.

Problem

  1. OpenAPI spec (docs/openapi.yaml) incorrectly documents list endpoints (GET /v1/grants etc.) as returning raw arrays. The implementation actually returns a GrantListResponse wrapper — the documented contract is wrong and misleading.
  2. Pagination uses limit/offset, which is inefficient for large datasets. Cursor pagination is partially implemented (test_gl304_bigserial_pagination.py) but not consistently used or documented.

Fix

  • Update OpenAPI spec so ALL list endpoints document the wrapper object (items + next_cursor + total or similar)
  • Implement consistent cursor-based pagination across ALL list endpoints (grants, grant_requests, users, audit, webhooks, api-keys)
  • Return next_cursor in every list response; deprecate offset (keep for one version with warning)
  • Regenerate /api/openapi.json to match

Acceptance Criteria

  • Every list endpoint returns {items, next_cursor, ...} wrapper
  • OpenAPI spec matches implementation exactly (contract test passes)
  • Cursor pagination works on all list endpoints
  • mypy clean, ruff clean, tests >= baseline

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions