2

Its my example. am trying fragment . am not sure how will i connect fragment to resolver. Can anyone help me?https://launchpad.graphql.com/9qvqz3v5r

If i query as below

 {
       user {
           userId
           firstName
           lastName
           pincode
           state
           country
      }
  }

I will get this output JSON

{
  "data": {
    "user": {
      "userId": 4,
      "firstName": "Priya",
      "lastName": "zzz",
      "pincode": "600021",
      "state": "TN",
      "country": "INDIA"
    }
  }
}

I need Same output if i query using fragment.

    {  
      user {
        userId
        firstName
        lastName
        addressDetails
      }
    }
mpriyaah
  • 65
  • 1
  • 7

1 Answers1

1

You can use fragment query like this, which returns same result

{
  user{
 ... userPayload
  }
}

fragment userPayload on User{
  userId
  firstName
  lastName
  pincode
  state
  country

}

I think this is the one you want

Seena V P
  • 934
  • 3
  • 9
  • 26