Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type system is insufficient - list and not-null can not be freely combined #18

Closed
hlship opened this issue Mar 27, 2017 · 3 comments
Closed

Comments

@hlship
Copy link
Member

hlship commented Mar 27, 2017

The current system is quite limited: you can add a not-null qualifier, meaning that the value may not be nil. You can add a list qualifier, meaning that the resolver returns a seq of values, not a single one. You can combine the two, meaning that the the values may not be nil (though the list itself may be).

This is a subset of what the GraphQL spec calls for; we should be able to say that a field's type is a non-null list of lists of non-null Strings, for example.

That means the list and not-null qualifiers need to be fully nestable, with some system of reified types to make it all work; a somewhat fundamental change to how the executor operates.

@mpenet
Copy link
Contributor

mpenet commented Mar 28, 2017

👍

I am actually in need of (list (list Int)) to port our schemas to graphql, I am not sure how to model this in the meantime. If you have workarounds feel free to advise me.

@bcarrell
Copy link
Contributor

bcarrell commented Mar 28, 2017 via email

@kgann
Copy link

kgann commented Mar 28, 2017

@mpenet

If you're willing to change your schema, I think you could use wrapper objects as a workaround. I haven't tested this.

:input-objects
{:inputInts {:fields {:ints {:type (list Int)}}}}

:objects
{:ints {:fields {:ints {:type (list Int)}}}}

:queries
{:foo {:args {:ints {:type (list :inputInts)}}}
       :type (list :ints)
       :resolve :foo-resolver}

Arguments and resolved types may be a bit odd:

{
  foo(ints: [{ints: [1, 2, 3]}, {ints: [4, 5, 6]}]) {
    ints
  }
}
{:data {:foo [{:ints [1 2 3]}
              {:ints [4 5 6]}]}

@hlship hlship modified the milestone: 0.1.15 Apr 5, 2017
@hlship hlship closed this as completed Apr 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants