question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support kotlin.collections.Set

See original GitHub issue

Is 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:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
smyrickcommented, Apr 3, 2019

@tapaderster The team brought up a good point that while Sets 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 a Set 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?

0reactions
smyrickcommented, Apr 2, 2021

See updated discussion: https://github.com/ExpediaGroup/graphql-kotlin/discussions/1110

You can add Set support with custom hooks

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found