Skip to content

Commit

Permalink
Merge pull request overblog#839 from mcg-web/fix-default-value
Browse files Browse the repository at this point in the history
Fix default value
  • Loading branch information
mcg-web authored May 4, 2021
2 parents 161c0e3 + 9be0121 commit d7184a3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Generator/TypeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,14 @@ public function buildField(array $fieldConfig, string $fieldname)
$field->addItem('useStrictAccess', false);
}

if ('input-object' === $this->type && isset($c->validation)) {
$field->addItem('validation', $this->buildValidationRules($c->validation));
if ('input-object' === $this->type) {
if (property_exists($c, 'defaultValue')) {
$field->addItem('defaultValue', $c->defaultValue);
}

if (isset($c->validation)) {
$field->addItem('validation', $this->buildValidationRules($c->validation));
}
}

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

if (isset($c->defaultValue)) {
$arg->addIfNotEmpty('defaultValue', $c->defaultValue);
if (property_exists($c, 'defaultValue')) {
$arg->addItem('defaultValue', $c->defaultValue);
}

if (!empty($c->validation)) {
Expand Down

0 comments on commit d7184a3

Please sign in to comment.