Skip to content

2.0-Alpha 2. Nullable types in input arrays don't seem to work. #3578

@scottasoutherland

Description

@scottasoutherland

Summary

We have a schema that contains

input InputArrayTypeOne {
    id: ID!
   //other properties
}

input InputArrayTypeTwo {
    id: ID!
    //other properties 
}

input InputType {
    id: ID
    inputsOne: [InputArrayTypeOne]
    inputsTwo: [InputArrayTypeTwo!]
}

And when we codegen this in apollo 2.0 alpha 2 we get the following error when compiling:

Cannot convert value of type 'GraphQLNullable<[InputArrayTypeOne?]>' to expected dictionary value type 'any GraphQLOperationVariableValue' . However, it seems like InputArrayTypeTwo works fine. I presume the problem is the nullability of the type within the array. Not sure if an optional type needs to be able to adhere to GraphQLOperationVariableValue directly, or if that type needs to be wrapped in it's own GraphQL nullable.

Version

2.0.0-alpha-2

Steps to reproduce the behavior

Create a schema that contains an array which can contain null values.
Codegen.
Compile generated code.

Logs

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions