graphql-js icon indicating copy to clipboard operation
graphql-js copied to clipboard

Changing argument type to a using a list of that same type should probably not be a breaking change

Open zmay2030 opened this issue 3 years ago • 0 comments

Hello, As per GraphQL spec If the value passed as an input to a list type is not a list and not the null value, then the result of input coercion is a list of size one, where the single item value is the result of input coercion for the list’s item type on the provided value (note this may apply recursively for nested lists). See here for more info Thus, if input argument changes from A to [A] for a field in schema, then the client will not break because per GraphQL spec, it is expected that sending the type as is will turn it into a list with length 1. So if say the OLD schema is:

type Query {
    foo(arg: String)
}

And the NEW schema is:

type Query {
    foo(arg: [String])
}

The below query will still work for both OLD and NEW schemas:

query {
   foo(arg: "foooo")
}

I therefore think this should not be a breaking change, but it seems like it is.

zmay2030 avatar Aug 18 '22 17:08 zmay2030