Skip to content

Commit

Permalink
Add numeric and integer min, max example values #97
Browse files Browse the repository at this point in the history
  • Loading branch information
mpociot committed Sep 14, 2016
1 parent 49635dd commit de38dad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Mpociot/ApiDoc/Generators/AbstractGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Faker\Factory;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
use Mpociot\ApiDoc\Parsers\RuleDescriptionParser as Description;
Expand Down Expand Up @@ -230,9 +231,15 @@ protected function parseRule($rule, $ruleName, &$attributeData, $seed)
break;
case 'min':
$attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
if (Arr::get($attributeData, 'type') === 'numeric' || Arr::get($attributeData, 'type') === 'integer') {
$attributeData['value'] = $faker->numberBetween($parameters[0]);
}
break;
case 'max':
$attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
if (Arr::get($attributeData, 'type') === 'numeric' || Arr::get($attributeData, 'type') === 'integer') {
$attributeData['value'] = $faker->numberBetween(0, $parameters[0]);
}
break;
case 'between':
if (! isset($attributeData['type'])) {
Expand Down

0 comments on commit de38dad

Please sign in to comment.