Skip to content

Commit

Permalink
Fix default value
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg-web committed May 4, 2021
1 parent 161c0e3 commit 9be0121
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 9be0121

Please sign in to comment.