Since `@nexus/schema@0.19` is out and a new "list...
# graphql-nexus
m
Since
@nexus/schema@0.19
is out and a new "list" "nullable "nonNull" API, which way is prefered ? 1. t.nonNull.list.nonNull.field(...) 2. t.field({ type: nonNull(list(nonNull(...))) ... }) I ask this question to prevent new eventual futur breaking changes
t
I’d say whichever reads better to you
I think I’d go with 1, unless it’s like a list of lists, then maybe I’d go with 2
m
I personnally really love 1 synthax as it's very fluent to read and avoid parenthesis hell. But even if I understand why there is two synthaxes (see https://github.com/graphql-nexus/schema/issues/591) I can't help to think that is a bit a shame to have 2 way to do the same thing. If I may, why don't propose a type/input/arg builder through ObjectDefinitionBlock ? like this :
Copy code
t.field('createUser', {
  type: t.nonNull.type('User'),
  args: {
    name: t.nonNull.arg('String'),
    email: t.nonNull.arg('String'),
    password: t.nonNull.arg('String'),
  },
  resolve: async (parent, args, ctx) => {
    // ...
  },
});
z
this change feels kind of weird to me tbh, what was the reason? the previous api seems cleaner and requires less imports and brackets
w
Hello @Zarazas, the reasons for this change were laid out and discussed here https://github.com/graphql-nexus/schema/issues/591