Issue #39 introduced a fix to allow default values for parameters in GraphQL resolver functions. However, this fix has inadvertently broken the handling of optional parameters in general.
Problem Description
The current implementation does not support optional parameters (foo?: string or foo: string | undefined) in resolver functions due to the changes made in the fix for Issue #39. While the fix correctly handles parameters with default values, it has caused a regression for optional parameters.
Define a GraphQL resolver with an optional parameter (foo?: string or foo: string | undefined).
Attempt to query using this resolver with and without providing the optional parameter.
Expected Behavior
The resolver functions should handle optional parameters correctly, returning the appropriate values based on whether the parameter is provided or not.
Actual Behavior
The resolver functions fail to handle optional parameters, leading to runtime errors or incorrect behavior.
Impact
This issue prevents the use of optional parameters in resolver functions, reducing the flexibility and usability of the GraphQL API.
Additional Information
Please refer to the original issue for context: Issue #39.
Original Issue Reference
Issue #39 introduced a fix to allow default values for parameters in GraphQL resolver functions. However, this fix has inadvertently broken the handling of optional parameters in general.
Problem Description
The current implementation does not support optional parameters (
foo?: string
orfoo: string | undefined
) in resolver functions due to the changes made in the fix for Issue #39. While the fix correctly handles parameters with default values, it has caused a regression for optional parameters.Examples
Required (Working):
Optional (Not Working):
Default Value (Working):
Steps to Reproduce
foo?: string
orfoo: string | undefined
).Expected Behavior
The resolver functions should handle optional parameters correctly, returning the appropriate values based on whether the parameter is provided or not.
Actual Behavior
The resolver functions fail to handle optional parameters, leading to runtime errors or incorrect behavior.
Impact
This issue prevents the use of optional parameters in resolver functions, reducing the flexibility and usability of the GraphQL API.
Additional Information
Please refer to the original issue for context: Issue #39.