You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, got another feature request for you. There's a lot of times where I'd like to derive some trait for an enum generated by graphql_schema_from_file. Currently I'm struggling with an enum generated for a union type that I need Clone on. Of course the workaround is to just implement Clone manually, but it definitely would be nice to have a derive. It would also be especially nice to be able to apply other attributes beyond derive to the struct definitions, e.g. serde attributes to customize serialization/deserialization.
I'm not sure what the implementation for this would look like, but I assume on the schema side we would have to define these via a directive. According to the graphql schema spec, directive values can be any type, so I'm thinking maybe a new directive field with a list of strings? Something like this:
type A {}
type B {}
@juniper(attributes: ["derive(Clone, Debug, Serialize)", "serde(tag = "type")"])
union U = A | B
What do you think? If this seems viable and you give me some direction on how to implement it, I can work on the actual code for it.
The text was updated successfully, but these errors were encountered:
Hey, got another feature request for you. There's a lot of times where I'd like to derive some trait for an enum generated by
graphql_schema_from_file
. Currently I'm struggling with an enum generated for a union type that I needClone
on. Of course the workaround is to just implementClone
manually, but it definitely would be nice to have a derive. It would also be especially nice to be able to apply other attributes beyondderive
to the struct definitions, e.g. serde attributes to customize serialization/deserialization.I'm not sure what the implementation for this would look like, but I assume on the schema side we would have to define these via a directive. According to the graphql schema spec, directive values can be any type, so I'm thinking maybe a new directive field with a list of strings? Something like this:
What do you think? If this seems viable and you give me some direction on how to implement it, I can work on the actual code for it.
The text was updated successfully, but these errors were encountered: