Api: Can't generate API documentation.

Created on 22 Jun 2016  Â·  33Comments  Â·  Source: dingo/api

After dingo/blueprint last update, getting message

  [ErrorException]
  Missing argument 4 for Dingo\Blueprint\Blueprint::generate(), called in /~/vendor/dingo/api/src/Console/Comm
  and/Docs.php on line 95 and defined

after running artisan api:docs --output-file docs.md

bug

Most helpful comment

I'm facing the same issue
[ErrorException] Missing argument 4 for Dingo\Blueprint\Blueprint::generate(), called in vendor/dingo/api/src/Console/Command/Docs.php on line 95 and defined
I put empty string as a fourth parameter in
$contents = $this->blueprint->generate($this->getControllers(), $this->getDocName(), $this->getVersion(), '');
at line 95 in the "handle" method inside "vendor/dingo/api/src/Console/Command/Docs.php"
and it worked fine for me.
it's just a workaround and I hope it helps.
thanks

All 33 comments

Same issue here.

Same issue here.

Same issue here.

Same issue here.

Same here.

Confirmed

Same issue in a Laravel 5.2.

[Solution] checkout master branch
"dingo/api": "dev-master",

add min stability and prefer stable option to composer.json
"minimum-stability": "dev",
"prefer-stable" : true

I try a "dingo/api": "dev-master" but the command artisan api:docs --output-file docs.md -vvv return

[InvalidArgumentException]
Expected a string. Got: boolean
Exception trace:
() at /home/vagrant/Projects/BePaddle/vendor/webmozart/assert/src/Assert.php:133
Webmozart\Assert\Assert::string() at /home/vagrant/Projects/BePaddle/vendor/webmozart/assert/src/Assert.php:142
Webmozart\Assert\Assert::stringNotEmpty() at /home/vagrant/Projects/BePaddle/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php:84
phpDocumentor\Reflection\DocBlockFactory->create() at /home/vagrant/Projects/BePaddle/vendor/dingo/blueprint/src/Resource.php:144
Dingo\Blueprint\Resource->getDescription() at /home/vagrant/Projects/BePaddle/vendor/dingo/blueprint/src/Blueprint.php:145
Dingo\Blueprint\Blueprint->Dingo\Blueprint{closure}() at /home/vagrant/Projects/BePaddle/vendor/laravel/framework/src/Illuminate/Support/Collection.php:146
Illuminate\Support\Collection->each() at /home/vagrant/Projects/BePaddle/vendor/dingo/blueprint/src/Blueprint.php:193
Dingo\Blueprint\Blueprint->generateContentsFromResources() at /home/vagrant/Projects/BePaddle/vendor/dingo/blueprint/src/Blueprint.php:114
Dingo\Blueprint\Blueprint->generate() at /home/vagrant/Projects/BePaddle/vendor/dingo/api/src/Console/Command/Docs.php:96
Dingo\Api\Console\Command\Docs->handle() at n/a:n/a
call_user_func_array() at /home/vagrant/Projects/BePaddle/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
Illuminate\Container\Container->call() at /home/vagrant/Projects/BePaddle/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
Illuminate\Console\Command->execute() at /home/vagrant/Projects/BePaddle/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /home/vagrant/Projects/BePaddle/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
Illuminate\Console\Command->run() at /home/vagrant/Projects/BePaddle/vendor/symfony/console/Application.php:791
Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/Projects/BePaddle/vendor/symfony/console/Application.php:186
Symfony\Component\Console\Application->doRun() at /home/vagrant/Projects/BePaddle/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at /home/vagrant/Projects/BePaddle/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/Projects/BePaddle/artisan:35

sry, it is another issue probably

I'm facing the same issue
[ErrorException] Missing argument 4 for Dingo\Blueprint\Blueprint::generate(), called in vendor/dingo/api/src/Console/Command/Docs.php on line 95 and defined
I put empty string as a fourth parameter in
$contents = $this->blueprint->generate($this->getControllers(), $this->getDocName(), $this->getVersion(), '');
at line 95 in the "handle" method inside "vendor/dingo/api/src/Console/Command/Docs.php"
and it worked fine for me.
it's just a workaround and I hope it helps.
thanks

Same here.

What version? I'm not facing this issue.

Same here.

same here!

@mohamed-atef thanks! that worked as a dirty hack to at least get our documents published. Would be helpful if we get an official fix on this.

Same here

Same here

Same here

+1

Same here

I tried to switch to the latest development build by

  1. requiring "dingo/api" : "dev-master"
  2. adding the lines
"minimum-stability": "dev",
"prefer-stable": true

to the top level of the composer file

The new version is installed (both for dingo/api and dingo/blueprint. However, after running
php artisan api:docs --name TEST --output-file /docs/docs.md

i get the following error:

  [InvalidArgumentException]
  Expected a string. Got: boolean

Can somebody help!?
Greetings

Anyone experiencing this issue, would you be willing to point me in the direct of a repo or gist, or something I can use to try and re-create this issue?

It happened to me just now after running composer update.
It looks like it have updated dingo/blueprint to the v.1.0.6 while leaving dingo/api at v1.0.0-beta3 which in fact doesn't pass $includePath to the blueprint generator.
My composer.json still includes "dingo/api": "1.0.*@dev" and it seems to be intact with the wiki.

So what I have now after update is this line here:
https://github.com/dingo/api/blob/v1.0.0-beta3/src/Console/Command/Docs.php#L95
calling this line from another package:
https://github.com/dingo/blueprint/blob/master/src/Blueprint.php#L83

Current master branch doesn't have this problem, so I guess it is some composer versioning problem?
Could you please suggest me how I can point dingo/api to be updated to master branch?

In fact here is the update log:

Updating dependencies (including require-dev)
...
  - Removing dingo/blueprint (v0.1.4)
  - Installing dingo/blueprint (v0.1.6)
    Downloading: 100%

  - Removing dingo/api (dev-master 98d3d00)
  - Installing dingo/api (v1.0.0-beta3)
    Downloading: 100%

If you change you're composer.json entry for dingo/api to point to dev-master, that should take care of it.

I think beta3 was tagged before that option was added. Might look into tagging a beta4 soon, which would then include the commits.

On Aug 17, 2016, at 11:30 PM, Alex [email protected] wrote:

In fact here is the update log:

  • Removing dingo/blueprint (v0.1.4)
  • Installing dingo/blueprint (v0.1.6)
    Downloading: 100%
  • Removing dingo/api (dev-master 98d3d00)
  • Installing dingo/api (v1.0.0-beta3)
    Downloading: 100%
    —
    You are receiving this because you commented.
    Reply to this email directly, view it on GitHub, or mute the thread.

@hskrasek in fact that did work, forgot about stability settings mentioned by @johannesschobel
Thank you for the temporary fix, hope this will get resolved soon. Cheers.

@johannesschobel 's fix totally works now working on dev-master. Don't forget to add the stability settings mentioned.

Still getting this error :
[InvalidArgumentException]
Expected a string. Got: boolean

Fixed it by commenting out https://github.com/phpDocumentor/ReflectionDocBlock/blob/master/src/DocBlockFactory.php#L84. Not sure the negative effects of this but it allows me to generate the docs which is what I need for now.

Anyone have a controller with DocBlock setup that I can use to re-create this issue?

I have 2 laravel installs, one is 5.2 and the other 5.3.
On 5.2 the documentation command works but on 5.3 I'm getting same error as @anthonydarwesh, however his fix did not work for me.

output of composer show | grep dingo:
dingo/api dev-master 242411e
dingo/blueprint v0.2.0

+1

i don't know which version was right 😠

Was this page helpful?
0 / 5 - 0 ratings