Closed
Description
Hi, as I wasn't able to find any way to do this I open this issue:
a way to create snake_case fields should be provided.
Now we can create an object
graphql_object!(Human: () |&self| {
field id() -> Option<&str> {
self.id.as_str()
}
field appearsIN() -> Vec<Episode> {
vec![Episode::NewHope, Episode::Jedi]
}
});
which results in
query {
human(id: "1234") {
id
appearsIN
}
}
but we can't create the following object due to the automatic field transformation
query {
human(id: "1234") {
id
appears_in
}
}
indeed
graphql_object!(Human: () |&self| {
field id() -> Option<&str> {
self.id.as_str()
}
field appears_in() -> Vec<Episode> {
vec![Episode::NewHope, Episode::Jedi]
}
});
will results in
query {
human(id: "1234") {
id
appearsIn
}
}