Does anybody know how to generate nullable array f...
# orm-help
s
Does anybody know how to generate nullable array fields with nexus? example would be:
Copy code
const foo = inputObjectType({
  name: 'foo',
  definition(t) {
    t.string('bar', { list: true, nullable: true })
  }
})
generated input is always:
Copy code
input foo {
  bar: [String!]
}
desired outcome would be:
Copy code
input foo {
  bar: [String]
}
h
why would you want that
the array is optional, it just can't contain null values, which are a footgun anyways
s
Because that’s how the existing web and native clients are making the graphql query. Also prior to using nexus with manually creating the schema you can do that. Not to mention if you can define the option to be null able you’d think the generated schema would adhere to what you defined.
Also I need the ability to send an empty array
h
@shane You can do that like so:
Copy code
t.string("test", {
      list: [false],
      nullable: true,
    })
s
@Harshit you’re A. Amazing but 7 minutes too late…we JUST figured it out using the SDL converter with my old schema…. but I thank you so much!
🙌 1
🍻 1
😅 1
need to utilize that converter more
it’s a nice tool
👍 1
h
it's just a really bad idea to have an optional array / nulls in an array
and you can always migrate from nullable to non nullable on the server
🤷