feat(api): add pagination to validators list#2703
Conversation
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Greptile SummaryThis PR adds optional pagination to the validators HTTP API endpoint with full backwards compatibility. When no
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["GET /validators"] --> B{"page or per_page\nin query?"}
B -- No --> C["List shares with filters"]
C --> D["Return {data: [...]}"]
B -- Yes --> E["Parse & validate\npagination params"]
E -- Invalid --> F["Return 400 Bad Request"]
E -- Valid --> G["List shares with filters"]
G --> H["Sort by ValidatorPubKey"]
H --> I["Compute SliceBounds\n(start, end)"]
I --> J["Slice shares[start:end]"]
J --> K["Return {data: [...],\npagination: {...}}"]
Last reviewed commit: 54fe4e3 |
e6e54ea to
9917396
Compare
9917396 to
589a5d7
Compare
oleg-ssvlabs
left a comment
There was a problem hiding this comment.
gj!
I think we also need to update Open API spec
|
@julienh-ssv This is a breaking change in the API, can we still use |
@y0sher yes it's fully retro-compatible |
There was a problem hiding this comment.
Looks good, got just 1 question about an edge-case
Add optional pagination to the validators http api with retro-compatibility