You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a GraphQL schema defines an argument as optional (nullable), but the corresponding Kotlin controller method parameter is required (non-nullable), a mismatch occurs. This can lead to runtime errors if the client omits the argument, as Kotlin expects a value.
Spring GraphQL does not provide warnings during schema inspection for this mismatch, making it difficult to identify the issue during development, especially when migrating huge GraphQL schema to Spring-graphQL project.
Short overview of the problem:
Define a GraphQL schema with an optional argument:
Thanks for raising this.
We have a broader nullness theme going on in the Spring portfolio. We should leverage the new Nullness API and work on this for the next 2.0 major version.
rstoyanchev
changed the title
Mismatch between GraphQL schema optional arguments and Kotlin non-nullable parameters
Schema inspection should detect mismatch between optional arguments in GraphQL schema and Kotlin non-nullable method parameters
May 29, 2025
When a GraphQL schema defines an argument as optional (nullable), but the corresponding Kotlin controller method parameter is required (non-nullable), a mismatch occurs. This can lead to runtime errors if the client omits the argument, as Kotlin expects a value.
Spring GraphQL does not provide warnings during schema inspection for this mismatch, making it difficult to identify the issue during development, especially when migrating huge GraphQL schema to Spring-graphQL project.
Short overview of the problem:
Define a GraphQL schema with an optional argument:
Kotlin controller with a non-nullable parameter for the optional argument:
GitHub full project to reproduce
The text was updated successfully, but these errors were encountered: