Repository navigation
Conversation
…ty override webonyx 15.38.3 (webonyx/graphql-php#1969) reports variable coercion errors from its QueryComplexity rule through the validation context, one located error per variable, instead of throwing a single joined error. That is what thecodingmachine#839's subclass did, so on 15.38.3 its catch never runs, and its test asserting no locations fails on current webonyx. limitQueryComplexity() registers webonyx's rule again. The unreleased subclass and its unit test are removed; the integration test keeps asserting a located error per invalid variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
webonyx/graphql-php 15.38.3 (webonyx/graphql-php#1969) changed its
QueryComplexityrule: a variable that fails coercion is now reported through the validation context, one error per variable with the location of its definition, and complexity analysis stops for the document. Before, the rule threw a single error joining every coercion message, without locations.That is what thecodingmachine#839's
TheCodingMachine\GraphQLite\Validator\Rules\QueryComplexitysubclass worked around. On 15.38.3 and later itscatchnever runs, and its testtestInvalidVariableOfAnotherOperationKeepsTheLimit, which asserts the error has nolocations, fails with the latest dependencies (it fails onmastertoday; upstream's last green run predates the webonyx release).Fix
webonyx/graphql-php^v15.38.3.Psr15GraphQLMiddlewareBuilder::limitQueryComplexity()registers webonyx'sQueryComplexityrule again.Tests
tests/Integration/QueryComplexityTest.php::testInvalidVariableIsRefusedWithItsLocationkeeps asserting one error per invalid variable, with its location, through the GraphQLite fixture schema and webonyx's rule. Run locally on PHP 8.5 withcomposer update(webonyx 15.39.0) andcomposer update --prefer-lowest(webonyx 15.38.3): phpunit 729 OK, phpstan no errors, phpcs clean.