What's the equivalent schema datatype for java.util.Set?

Viewed 410

I am using GraphQL for Java and need to use Set / HashSet datatype for one of the member of my existing POJO to build by GraphQL schema. Any advice and insight is appreciated.

1 Answers

There is no built-in set type in GraphQL , sorry about that.

What you get the closest one is List type which is represented by enclosing any types using [ and ] such as [String] , [Int] , [Bar] etc. It can accept multiple elements but does not guarantee uniqueness between the containing elements.

You may consider to implement a directive for a set behaviour. May be called @set which is placed along with the list data type when defining your GraphQL schema.

Related