Open
Description
When creating graphql objects using the GraphQLObject
custom derive which have types that do not implement GraphQLType
you end up being forced to use the #[juniper::object]
proc macro and redefine methods to expose each and every field manually. It would be useful to have a #[graphql(transform = "fn_name")]
field attribute that would allow users to transform the type into another ie. u64 (snowflake) to string.
example:
/// User id struct from library, so it is impossible to derive GraphQLType
pub struct UserId(pub u64);
#[derive(GraphQLObject)]
struct GraphQLObj {
normal_string: String,
#[graphql(transform = "ToString::to_string")]
custom_type: UserId
}
This improvement would probably be a better solution to #553.
could be a possible duplicate of #652