-
Notifications
You must be signed in to change notification settings - Fork 434
Open
Labels
enhancementImprovement of existing features or bugfixImprovement of existing features or bugfix
Milestone
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
vstepchik
Metadata
Metadata
Assignees
Labels
enhancementImprovement of existing features or bugfixImprovement of existing features or bugfix