-
-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConvertEmptyStringsToNullDirective not executed when applied on fields where the argument is an input type #2610
Labels
bug
An error within Lighthouse
Comments
Can you add provide a pull request with a failing test case? |
spawnia
added a commit
that referenced
this issue
Sep 6, 2024
spawnia
changed the title
ConvertEmptyStringsToNullDirective not executed when applied globally or to input
ConvertEmptyStringsToNullDirective not executed when applied on fields where the argument is an input type
Sep 6, 2024
Thank you for your persistence @dennis-koster, fixed with https://github.com/nuwave/lighthouse/releases/tag/v6.44.2. |
spawnia
added
bug
An error within Lighthouse
and removed
needs reproduction
Failing test case needed
labels
Sep 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The
ConvertEmptyStringsToNullDirective
is not executed when it is applied globally or to an input, where the expected behaviour would be that it would apply the conversion recursively. It appears to me that this change has introduced this bug, because the added if check now makes it so that the sanitize method is only applied if the type of input is a string, negating the intended recursive nature.Expected behavior/Solution
The directive should be executed when applied to an input or globally, as described in the documentation.
Steps to reproduce
Given the following schema:
Execute the following mutation:
Expected outcome would be for the
insertion
attribute to be converted to null in the following scenarios:1.
\Nuwave\Lighthouse\Schema\Directives\ConvertEmptyStringsToNullDirective::class,
is added to thefield_middleware
array in thelighthouse.php
configuration file.2. The directive is applied to the input as such:
Lighthouse Version
v6.43.1
The text was updated successfully, but these errors were encountered: