Skip to content

Commit

Permalink
Add support of constants values https://json-schema.org/understanding…
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Yakoviv committed Oct 14, 2019
1 parent c50cfbf commit c88d631
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Faker.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public function generate($schema, \stdClass $parentSchema = null, string $schema
return Base::randomElement($schema->enum);
}

if (isset($schema->const)) {
return Base::randomElement([$schema->const]);
}

if (! isset($this->fakers[$type])) {
throw new UnsupportedTypeException($type);
}
Expand Down

0 comments on commit c88d631

Please # to comment.