Skip to content

Commit be85cb5

Browse files
author
Krzysztof Trzos
authored
Bug on validating fields when validation is cascade
I was having this example: ```yaml Mutation: type: object config: fields: create: type: "Ladder!" resolve: "@=mutation('LadderCreate', [args, context, validator])" access: '@=isAuthenticated()' args: input: type: "LadderInput!" validation: cascade LadderInput: type: input-object config: fields: name: type: String! validation: - NotBlank: ~ - Length: min: 10 max: 100 matchesSystem: type: "[MatchesSystemEnum!]!" ``` I.e. the `matchesSystem` field in `LadderInput` had no `validation`, so the `InputValidator.php` was crashing as it had no `$inputField->config['validation']`. Probably the default value should be an empty array.
1 parent 901f36c commit be85cb5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Validator/InputValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private function createObjectNode(array $value, $type, ValidationNode $parent):
210210
$propertiesMapping = [];
211211

212212
foreach ($type->getFields() as $fieldName => $inputField) {
213-
$propertiesMapping[$fieldName] = $inputField->config['validation'];
213+
$propertiesMapping[$fieldName] = $inputField->config['validation'] ?? [];
214214
}
215215

216216
return $this->buildValidationTree(

0 commit comments

Comments
 (0)