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

Support non-nullable list items as before #199

Closed
newellista opened this issue Jul 17, 2018 · 1 comment
Closed

Support non-nullable list items as before #199

newellista opened this issue Jul 17, 2018 · 1 comment

Comments

@newellista
Copy link

Expected Behaviour

func (g *GraphQL) Query_users(ctx context.Context) ([]User, error)

Actual Behavior

func (g *GraphQL) Query_users(ctx context.Context) ([]*User, error)

Minimal graphql.schema and models to reproduce

type Query {
  users: [Users]
}

Notes:

Before #191 this worked correctly. However, after that PR was merged, it always generates the optional form when returning a slice.

I would expect

type Query {
  users: [Users]!
}

to return

func (g *GraphQL) Query_users(ctx context.Context) ([]*User, error)

while

type Query {
  users: [Users]
}

should return:

func (g *GraphQL) Query_users(ctx context.Context) ([]User, error)
@vektah
Copy link
Collaborator

vektah commented Jul 18, 2018

Did you try a required list of required elements:

type Query {
    user: [Users!]!
}

What you have [Users]! is a required list of nullable elements

read more

@vektah vektah closed this as completed Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants