nestjs/graphql: How to return mixed array of values and nulls?

nestjs/graphql: How to return mixed array of values and nulls?


0

I’m using @nestjs/graphql to build graphql API. I have the following object

@ObjectType('Round')
export class RoundDto {
  @Field(() => GraphQLInt)
  round: number;

  @Field(() => [[GraphQLString]])
  teams: Nullable<[string, string]>[];
}

How Can I declare the teams field to return mixed values of string and null?
Do I need to write own scalar for it?

I’m expecting to receive teams like

teams: [[1, 2], null, [3, 4], null]

But getting the error
Cannot return null for non-nullable field Round.teams.


Load 4 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *