Support kotlin.collections.Set
See original GitHub issueIs your feature request related to a problem? Please describe.
Right now the current support collections we can convert to a GraphQL list (List
, Array
) to do provide a uniqueness guarantee like Set
Describe the solution you’d like
We would like to use a Set<T>
as a unique collection of values instead of a List<T>
or Array<T>
Describe alternatives you’ve considered
We could use List
in the schema code but then we would have to manually perform some operation to remove duplicates in the list
Additional context
This is the error that is thrown when Set
is used in the schema
Cannot convert kotlin.collections.Set<kotlin.String> since it is outside the supported packages [com.expedia]
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Set - Kotlin Programming Language
A generic unordered collection of elements that does not support duplicate elements. Methods in this interface support only read-only access to the set; ......
Read more >Collections overview - Kotlin
List is an ordered collection with access to elements by indices – integer numbers that reflect their position. Elements can occur more than...
Read more >Collections in Java and Kotlin
This guide explains and compares collection concepts and operations in Java and Kotlin. It will help you migrate from Java to Kotlin and ......
Read more >kotlin.collections - Kotlin Programming Language
A collection that holds pairs of objects (keys and values) and supports efficiently retrieving the value corresponding to each key. Map keys are...
Read more >set - Kotlin Programming Language
Allows to use the index operator for storing values in a mutable map. Stay in touch: Contributing to Kotlin · Releases · Press...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tapaderster The team brought up a good point that while
Set
s could be used from a server perspective that information is not part of the GraphQL spec so clients could pass in a list of items as input but if the server used aSet
as the input then it would remove those items. The developer may want to do this but I feel like this would be an implementation detail and shouldn’t be part of the schema serialization/deserialization.My point being GraphQL really only supports lists, so we should as well. Does everyone agree?
See updated discussion: https://github.com/ExpediaGroup/graphql-kotlin/discussions/1110
You can add
Set
support with custom hooks