From 61502c9ff014f5c7544e7d61892bd6eb9003602e Mon Sep 17 00:00:00 2001 From: murtukov Date: Sun, 2 Nov 2025 19:02:33 +0100 Subject: [PATCH] Rollback changes done to the InputValidator and the relevant tests --- src/Validator/InputValidator.php | 5 ----- .../config/validator/mapping/Mutation.types.yml | 8 -------- .../config/validator/mapping/Person.types.yml | 14 -------------- .../Functional/Validator/InputValidatorTest.php | 16 ---------------- 4 files changed, 43 deletions(-) delete mode 100644 tests/Functional/App/config/validator/mapping/Person.types.yml diff --git a/src/Validator/InputValidator.php b/src/Validator/InputValidator.php index 8059456ed..c5ba9f9b7 100644 --- a/src/Validator/InputValidator.php +++ b/src/Validator/InputValidator.php @@ -140,11 +140,6 @@ private function buildValidationTree(ValidationNode $rootObject, iterable $field $property = $arg['name'] ?? $name; $config = static::normalizeConfig($arg['validation'] ?? []); - if (!array_key_exists($property, $inputData)) { - // This field was not provided in the inputData. Do not attempt to validate it. - continue; - } - if (isset($config['cascade']) && isset($inputData[$property])) { $groups = $config['cascade']; $argType = $this->unclosure($arg['type']); diff --git a/tests/Functional/App/config/validator/mapping/Mutation.types.yml b/tests/Functional/App/config/validator/mapping/Mutation.types.yml index e320f09ac..ede5d948b 100644 --- a/tests/Functional/App/config/validator/mapping/Mutation.types.yml +++ b/tests/Functional/App/config/validator/mapping/Mutation.types.yml @@ -138,11 +138,3 @@ Mutation: validation: cascade: groups: ['group2'] - - onlyPassedFieldsValidation: - type: Boolean - resolve: '@=m("mutation_mock", args)' - args: - person: - validation: cascade - type: Person! diff --git a/tests/Functional/App/config/validator/mapping/Person.types.yml b/tests/Functional/App/config/validator/mapping/Person.types.yml deleted file mode 100644 index bb8e29642..000000000 --- a/tests/Functional/App/config/validator/mapping/Person.types.yml +++ /dev/null @@ -1,14 +0,0 @@ -Person: - type: input-object - config: - fields: - firstName: - type: String - validation: - - NotBlank: ~ - - NotNull: ~ - surname: - type: String - validation: - - NotBlank: ~ - - NotNull: ~ diff --git a/tests/Functional/Validator/InputValidatorTest.php b/tests/Functional/Validator/InputValidatorTest.php index f454ab057..4bd76823c 100644 --- a/tests/Functional/Validator/InputValidatorTest.php +++ b/tests/Functional/Validator/InputValidatorTest.php @@ -87,22 +87,6 @@ public function testLinkedConstraintsValidationPasses(): void $this->assertTrue($result['data']['linkedConstraintsValidation']); } - public function testOnlyPassedFieldsValidated(): void - { - $query = ' - mutation { - onlyPassedFieldsValidation( - person: { firstName: "Joe" } - ) - } - '; - - $result = $this->executeGraphQLRequest($query); - - $this->assertTrue(empty($result['errors'])); - $this->assertTrue($result['data']['onlyPassedFieldsValidation']); - } - public function testLinkedConstraintsValidationFails(): void { $query = '