objection-graphql
objection-graphql copied to clipboard
Return empty array instead of null
I'm pretty new to GraphQL, maybe this is a user-error. Let's say i have a table "person" with the following JSON Schema:
{
type: 'array',
required: ['username'],
properties: {
username: { type: 'string' },
stringList: {
type: 'array',
items: {
type: 'string'
}
}
}
}
And the following GraphQL-Query:
{
profile(username: "test") {
stringList
}
}
I would expect it to return:
{
stringList: []
}
But it returns:
{
stringList: null
}
According to some StackOverflow Post i would need to modify the GraphQL-Schema, that gets generated by objection-graphql. Is there any way to achieve this with objection-graphql?