I'm just trying to set up some basic examples. I want to go "code first", I need the C# compiler to tell me where I'm going wrong.
If I look at https://chillicream.com/docs/hotchocolate/v10/schema/object-type/
there is an example
type Person {
id: Int!
name: String!
friends: [Person]
}
which allegedly is the result of this C# code
public class PersonType
: ObjectType<Person>
{
protected override void Configure(IObjectTypeDescriptor<Person> descriptor)
{
descriptor.Field(t => t.Name).Type<NonNullType<StringType>>();
descriptor.Field("friends")
.Type<ListType<NonNullType<StringType>>>()
.Resolver(context =>
context.Service<IPersonRepository>().GetFriends(
context.Parent<Person>().Id));
}
}
Ok, so id is missing, but the documentation goes on to explain that hot chococolate will fill in the gaps (something I'm not a fan of...but putting that aside). then we have "name", which is a string, and this would seem to correspond with
.Type<NonNullType<StringType>>()
ok, thats believable, "friends" though seems bizarre. the "Type" is
.Type<ListType<NonNullType<StringType>>>()
where I would expect something that more obviously mapped to "[Person]"
Is the doc wrong? or is my understanding wrong?