I'm trying to organize my query in such way
public class RootQueryType : ObjectType
{
protected override void Configure(IObjectTypeDescriptor descriptor)
{
descriptor.Include<UserQuery>().Name("userQuery");
descriptor.Include<MessageQuery>().Name("messageQuery");
}
}
But in my Altair playground I end up with this:
There is no userQuery
, but I still can query fields from it. I think that it is not the way Include should work and I'm looking for a way to get messageQuery and userQuery separated.
Include merges all the fields of the included type into the current type. Name
refers to the name of the current type. In order to get another level in your type just create a field that returns the new type.
Did you know that you do not need these type descriptors but can just express everything with pure C#.
public class Query
{
public UserQuery GetUsers() => new UserQuery();
}
public class UserQuery
{
...
}
This will result in:
type Query {
users: UserQuery
}
type UserQuery {
# ...
}