GraphQL List or single object
<p>I got the following "problem". I am used to having an API like that. </p>

<pre><code>/users
/users/{id}
</code></pre>

<p>The first one returns a list of users. The second just a single object. I would like the same with GraphQL but seem to fail. I got the following Schema</p>

<pre><code>var schema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'Query',
    fields: {
      users: {
        type: new GraphQLList(userType),
        args: {
          id: {type: GraphQLString}
        },
        resolve: function (_, args) {
          if (args.id) {
            return UserService.findOne(args.id).then(user =&gt; [user]);
          } else {
            return UserService.find()
          }
        }
      }
    }
  })
});
</code></pre>

<p>How can I modify the type of users to either return a List OR a single object? </p>