Is it possible to declare GQL schema in a way that allows returning model objects from query resolvers and serialize them into json later down the line? Let's say I have:
@graphQLClass
@serializable
abstract class _Todo extends Model {
String? get text;
bool? get isComplete;
}
and now I'd like my resolver to only care about what model data to return back:
If I try to manually edit generated file to resolve e.g. id value and declare generic type arguments, I get static analysis error because generic type args of type parameters don't match anymore:
field<String?, Todo>(
'id',
// The argument type 'GraphQLScalarType<String, String>' can't be assigned to the parameter type 'GraphQLType<String?, Todo>'.
graphQLString,
resolve: (serialized, argumentValues) {
return serialized.id;
},
)
Is what I'm trying to achieve possible to implement using Angel? I have a feeling that I'm missing some important part here.
Cheers!
Is it possible to declare GQL schema in a way that allows returning model objects from query resolvers and serialize them into json later down the line? Let's say I have:
and now I'd like my resolver to only care about what model data to return back:
If I try to run
todo
query it returns:Looks like this is because generated
todoGraphQLType
fields don't specifyresolve
parameter in which caseresolveFieldValue
returnsnull
: https://github.com/dukefirehawk/graphql_dart/blob/master/graphql_server/lib/graphql_server2.dart#L612If I try to manually edit generated file to resolve e.g.
id
value and declare generic type arguments, I get static analysis error because generic type args oftype
parameters don't match anymore:Is what I'm trying to achieve possible to implement using Angel? I have a feeling that I'm missing some important part here. Cheers!