I use the project https://github.com/mpociot/laravel-apidoc-generator to create documentation.

There were several problems.

  • It does not display in the request parameters the validation rules for the array element, i.e.

    'array.*.item' => 'required|bool'

  • It does not display custom rules for fields, although the rules themselves __toString method is described.

On the first problem - in this file, the getParameters method gets the parameters from the validator, but all but the rules for the elements of the array.

How can I get the validator to return all the rules that are described for the route?

    1 answer 1

    And so on the problem of displaying array elements from the request: Removed the validator, we get the validation rules directly from the route, added a method to break the rules by analogy with the validator:

     $validatorRules = $this->getRules($this->getRouteRules($routeAction['uses'], $bindings)); 

    To solve the second problem - added several custom types (custom_string, custom_integer, custom_boolean, custom_date), you can use them by describing a custom rule in the __toString method, for example

     custom_string:Custom rule description 

    Made fork with a fix of these problems.

    https://github.com/mykolaivashchuk/laravel-apidoc-generator