interface IAnimal{
id: ID!
name: String!
}
type Cow implements IAnimal{
color: String!
}
type Pig implements IAnimal{
weight: Int!
}
type Horse implements IAnimal{
nickname: String!
}
type Farm{
animals: [IAnimals!]!
}
How can I assemble a query that will return for each animal the extra fields it has.
For example, if there are a horse and a pig in the Farm I want to get the id, name, and nickname for the horse and for the pig the id, name, and weight.
I will clearify my question
I want to get al the animals in the farm but for each animal present all of its data.
in the farm I have an array of IAnimals as I mentioned in the schema so the type should be figured on runtime.
That’s the kind of query I am looking for and it should be in GQL if possible.