mtrajano / laravel-swagger

Auto generates the swagger documentation of a laravel project based on best practices and simple assumptions
167 stars 71 forks source link

FormRequest with arrays #29

Open pleaz opened 4 years ago

pleaz commented 4 years ago

when we use arrays validation, in "Example Value" it will generate null value for that parameter.

mtrajano commented 4 years ago

Sorry can you provide a little more information for this? A short code snippet and expected output would really help

pleaz commented 4 years ago

when validation FormRequest's class has something like this:

class SomeRequest extends FormRequest 
{
    public function rules()
    {
        return [
            'mass' => 'array',
            'mass.*.id' => 'required',
            'mass.*.name' => 'required',
...

then script generate this:

{
  "mass": [
    null
  ]
...
mtrajano commented 4 years ago

That doesn’t seem right do the other params gets generated correctly? It may be related to a bug that got introduced but fixed recently, do you get the same results on 0.6.3?

pleaz commented 4 years ago

I'm using that fork https://github.com/coopersystem-fsd/laravel-swagger, because option allows using JWT very handy