juniper
juniper copied to clipboard
Implement HashSet support the same way as Vec
This PR implements support for converting HashSet<T> into GraphQL exactly the same way as Vec<T>. Only output-related traits were implemented:
- IsOutputType
- GraphQLType
- BaseType
- WrapType
- GraphQLValueAsync
Use case
Consider this struct
#[derive(Debug, Serialize, Deserialize, Eq, Clone, GraphQLObject)]
#[graphql(scalar = RustScalarValue)]
pub struct KeywordCounter {
pub full_list: Vec<String>, // <---- a list, works fine as-is
pub unique_list: HashSet<String>, // <---- the same as full_list from GQL perspective, but fails because of no HashSet impl
pub c: u64, // <---- a custom scalar, works fine
}