NonNullType for attribute generated object types
josepvg opened this issue · 1 comments
Product
Hot Chocolate
Version
14
Link to minimal reproduction
Exaple in steps to reproduce
Steps to reproduce
If i define a class like this:
[ObjectType]
public static partial class AppointmentNode
{
then i can not use it in a NonNullType like this
descriptor.Field(f => f.TAppointments)
.Name("appointments")
.Description("The appointments for this resource")
.Type<NonNullType<ListType<NonNullType< AppointmentNode >>>>() // Explicitly define the type
.UseFiltering();
I had to use the old
public class AppointmentNode : ObjectType
{
What is expected?
defining the class using the objecttype attribute should work the same
What is actually happening?
Compile type error since AppointmentNode is not of type IType
Relevant log output
Additional context
No response
[ObjectType]
public static partial class AppointmentNode
Is not valid in any case. The source generator API you are referring to only exists when you specify the generic [ObjectType<Appointment>]
in which case you can refer in the fluent api to it like the following:
NonNullType<ListType<NonNullType<ObjectType<AppointmentNode>>>>>
the ObjectTypeAttribute
that is non generic is for if you have an instance type like
[ObjectType]
public class Appointment
{
public int Id { get; set: }
}
in which case you refer to it in the same way as shown above.