Skip to content

feat: extend /governance/dreps with status, voting power, metadata + new query params#457

Open
slowbackspace wants to merge 3 commits into
masterfrom
feat/governance-dreps-extended
Open

feat: extend /governance/dreps with status, voting power, metadata + new query params#457
slowbackspace wants to merge 3 commits into
masterfrom
feat/governance-dreps-extended

Conversation

@slowbackspace
Copy link
Copy Markdown
Contributor

Summary

Enriches the paginated /governance/dreps response so wallets can render a useful, sortable, filterable DRep list in a single call instead of 1 + 2N round-trips against /dreps, /dreps/{id}, and /dreps/{id}/metadata.

Response changes (additive)

Each row in /governance/dreps now includes:

  • has_script, amount, retired, expired, last_active_epoch — previously only available on /dreps/{drep_id}
  • metadata — embedded { url, hash, json_metadata, bytes, error? } matching the shape of /dreps/{drep_id}/metadata. Fields are null when the DRep has no registration anchor (e.g. drep_always_abstain, drep_always_no_confidence); when an anchor exists but off-chain content could not be fetched, error is populated.

Deprecated fields (active, active_epoch) intentionally not included.

New query params

  • ?order_by=amount — sort by voting power. Combines with the existing ?order=asc|desc.
  • ?retired=true|false — filter by registration state.
  • ?expired=true|false — filter by activity state.

When retired/expired filters are present, each page still returns up to count matching rows (filter → sort → limit).

Test plan

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openapi Ready Ready Preview, Comment Jun 4, 2026 3:02pm

Request Review

…new query params

Augments the paginated /governance/dreps response so wallets can render and rank
DReps without a follow-up call per row. Each DRep now also returns has_script,
amount, retired, expired, last_active_epoch, and an embedded metadata object
matching the shape of /dreps/{drep_id}/metadata. Deprecated fields (active,
active_epoch) are intentionally omitted from this enriched response.

New query parameters:
- order_by=amount  (in addition to existing order=asc|desc)
- retired=true|false
- expired=true|false

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Cardano Governance GET /governance/dreps OpenAPI specification to support richer DRep list rendering in clients by adding new response fields and additional query parameters for sorting and filtering.

Changes:

  • Expanded /governance/dreps response items with status/voting power fields (amount, has_script, retired, expired, last_active_epoch) and embedded metadata.
  • Added new query parameters to /governance/dreps: order_by=amount, retired, and expired, and clarified order semantics relative to order_by.
  • Regenerated published OpenAPI artifacts (YAML/JSON/docs), TypeScript generated types, and updated schema snapshot.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/tests/snapshots/get-schema-for-endpoint.test.ts.snap Snapshot updated to reflect new query params and enriched /governance/dreps response schema.
src/schemas/governance/dreps.yaml Source schema updated with new fields and embedded metadata object.
src/paths/api/governance/dreps/index.yaml Added order_by, retired, expired query params and updated order description.
src/generated-types.ts Regenerated TS types for new query params and response fields.
openapi.yaml Regenerated OpenAPI YAML with new params/response schema.
openapi.json Regenerated OpenAPI JSON with new params/response schema.
docs/blockfrost-openapi.yaml Regenerated docs OpenAPI YAML.
blockfrost-openapi.yaml Regenerated packaged OpenAPI YAML.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/schemas/governance/dreps.yaml Outdated
Comment thread src/schemas/governance/dreps.yaml Outdated
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants