Skip to content

Add GraphQL schema and resolver for the indexer (optional API layer) #374

Description

@Levi-Ojukwu

Description
Some integrators prefer GraphQL over REST for flexible queries (e.g. fetching invoice plus payer reputation in a single request). Adding an optional GraphQL API layer to the indexer makes it a more versatile data source.

Requirements and context

  • Use graphql-yoga to add a GraphQL endpoint at /graphql
  • Schema types mirroring existing REST resources: Invoice, ReputationScore, GovernanceProposal, ContractStats
  • Queries: invoice(id), invoices(filter, pagination), reputation(address), leaderboard(limit), stats
  • Each query must resolve from the same indexed database as the REST API (no duplicate data stores)
  • Write resolver tests and include the GraphQL playground in development mode

Suggested execution

git checkout -b feat/indexer-graphql
  • Install graphql-yoga
  • Define schema in indexer/src/api/graphql/schema.ts
  • Implement resolvers in indexer/src/api/graphql/resolvers.ts
  • Write resolver unit tests

Example commit message
feat(indexer): add optional GraphQL API layer with invoice, reputation, and stats queries


Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions