Skip to content

Commit d7184a3

Browse files
authored
Merge pull request #839 from mcg-web/fix-default-value
Fix default value
2 parents 161c0e3 + 9be0121 commit d7184a3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Generator/TypeBuilder.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,14 @@ public function buildField(array $fieldConfig, string $fieldname)
729729
$field->addItem('useStrictAccess', false);
730730
}
731731

732-
if ('input-object' === $this->type && isset($c->validation)) {
733-
$field->addItem('validation', $this->buildValidationRules($c->validation));
732+
if ('input-object' === $this->type) {
733+
if (property_exists($c, 'defaultValue')) {
734+
$field->addItem('defaultValue', $c->defaultValue);
735+
}
736+
737+
if (isset($c->validation)) {
738+
$field->addItem('validation', $this->buildValidationRules($c->validation));
739+
}
734740
}
735741

736742
return $field;
@@ -770,8 +776,8 @@ public function buildArg(array $argConfig, string $argName): Collection
770776
$arg->addIfNotEmpty('description', $c->description);
771777
}
772778

773-
if (isset($c->defaultValue)) {
774-
$arg->addIfNotEmpty('defaultValue', $c->defaultValue);
779+
if (property_exists($c, 'defaultValue')) {
780+
$arg->addItem('defaultValue', $c->defaultValue);
775781
}
776782

777783
if (!empty($c->validation)) {

0 commit comments

Comments
 (0)