sikanhe / gqtx

Code-first Typescript GraphQL Server without codegen or metaprogramming
458 stars 13 forks source link

fix: non required argument can be undefined if it is not provided at … #35

Closed n1ru4l closed 3 years ago

n1ru4l commented 3 years ago

…all and has no default value.

closes https://github.com/sikanhe/gqtx/issues/34

type Query {
  foo(a: String): Boolean
}
query foo {
  foo
}

For the following query on the given schema, the actual runtime type in the resolver for the a argument is undefined. It is only null if the argument is explicitly set to null, either via a default argument, or variable.

I guess this makes sense as in your resolvers you might have a database calls that updates a value that is either a string or null. If the argument is undefined that means the value must not be updated.

sikanhe commented 3 years ago

@n1ru4l Makes sense