0

I am trying to design a graphql API and I want to use apollo federation v2.

I have two subgraph or micro-services:

  1. Billing Subgraph: responsible to retrieve a bill for a customer
  2. Payment Subgraph: responsible to fetch payment for a customer

Billing subgraph schema is like:


type Query {
    Bill(billNumber: ID!) : Bill
}

type Bill {
    billNumber: ID!
    customerId: String
    billingLines: [BillingLine]
    paymentInfo: payment
    ....
}

Payment subgraph schema is like:


type Query {
    Payment(paymentId: ID!) : Payment
}

type Payment {
    paymentId: ID!
    amountPaid: float
    ....
}

How can get the payment object which is available as part of the payment subgraph in Bill subgraph?

What apollo graphql directives I need to use to so that I can do the schema composition in this case for the supergraph?

I looked at the documentation at https://www.apollographql.com/docs/federation/ and found that for a type in the super graph, its fields can be resolved at multiple subgraphs, but couldn't find a way on how to compose the above scenario.

Varun
  • 35
  • 4

0 Answers0