'How to send qraphql query with fragment inside a fragment? Apollo Android
I'm trying to simplify my query to graphql and I ended up duplicating code in the query
here are what similar to what I have.
fragment VehicleFragment on Vehicle {
id
name
type
brand
childs{
id
name
type
}
}
1- can I use the VehicleFragment again inside my fragment?
secon thing I'm trying to achieve somehting like this
query FetchVehicles($filter: ProductFilterInput!) {
vehicles() {
... VehicleFragment
childs{
... VehicleFragment
}
}
}
when I'm using the second query with Apollo client for Android it generate only a model with the VehicleFragment without the childs object like this
data class Vehicle(
val __typename: String = "Vehicle",
val fragments: Fragments
)
data class Fragments(
val vehicleFragment: VehicleFragment
)
2- what is the best way to achieve this ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
