juniper
juniper copied to clipboard
Enums doc is wrong
Describe the bug Enums docs states that corresponding string values for the enum variants are all in uppercase. This is not the case
To Reproduce Declare an enum like
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "graphql", derive(juniper::GraphQLEnum))]
pub enum ConfigType {
New,
AlreadyExisting,
}
When querying the GraphQL enum I got the following output
[root@node1 ~]# curl -k https://localhost/graphql_schema 2> /dev/null | grep "enum ConfigType" -A 4
enum ConfigType {
NEW
ALREADY_EXISTING
}
Expected behavior Following the docs I was expecting:
[root@node1 ~]# curl -k https://localhost/graphql_schema 2> /dev/null | grep "enum ConfigType" -A 4
enum ConfigType {
NEW
ALREADYEXISTING
}
I think it originated from https://github.com/graphql-rust/juniper/pull/765 and the docs weren't updated
@RDruon thanks!
I've haven't found anything about what variant is right in GraphQL spec.
But Apollo docs say:
- Enum values should use
ALL_CAPS
, because they are similar to constants.
@ilslv so the current behavior is preferred, and we need to updated the relevant docs only.