api:docs Expected a string. Got: boolean

Created on 23 Aug 2016  路  12Comments  路  Source: dingo/api

Running into an issue generating documentation:

artisan api:docs -vvv

  [InvalidArgumentException]
  Expected a string. Got: boolean
Exception trace:
 () at /Users/timbroder/workspace/kidfund/web/vendor/webmozart/assert/src/Assert.php:149
 Webmozart\Assert\Assert::string() at /Users/timbroder/workspace/kidfund/web/vendor/webmozart/assert/src/Assert.php:158
 Webmozart\Assert\Assert::stringNotEmpty() at /Users/timbroder/workspace/kidfund/web/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php:84
 phpDocumentor\Reflection\DocBlockFactory->create() at /Users/timbroder/workspace/kidfund/web/vendor/dingo/blueprint/src/Resource.php:144
 Dingo\Blueprint\Resource->getDescription() at /Users/timbroder/workspace/kidfund/web/vendor/dingo/blueprint/src/Blueprint.php:145
 Dingo\Blueprint\Blueprint->Dingo\Blueprint\{closure}() at /Users/timbroder/workspace/kidfund/web/bootstrap/cache/compiled.php:12602
 Illuminate\Support\Collection->each() at /Users/timbroder/workspace/kidfund/web/vendor/dingo/blueprint/src/Blueprint.php:193
 Dingo\Blueprint\Blueprint->generateContentsFromResources() at /Users/timbroder/workspace/kidfund/web/vendor/dingo/blueprint/src/Blueprint.php:114
 Dingo\Blueprint\Blueprint->generate() at /Users/timbroder/workspace/kidfund/web/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 /Users/timbroder/workspace/kidfund/web/bootstrap/cache/compiled.php:1257
 Illuminate\Container\Container->call() at /Users/timbroder/workspace/kidfund/web/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
 Illuminate\Console\Command->execute() at /Users/timbroder/workspace/kidfund/web/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at /Users/timbroder/workspace/kidfund/web/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
 Illuminate\Console\Command->run() at /Users/timbroder/workspace/kidfund/web/vendor/symfony/console/Application.php:847
 Symfony\Component\Console\Application->doRunCommand() at /Users/timbroder/workspace/kidfund/web/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at /Users/timbroder/workspace/kidfund/web/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at /Users/timbroder/workspace/kidfund/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
 Illuminate\Foundation\Console\Kernel->handle() at /Users/timbroder/workspace/kidfund/web/artisan:36

Composer:

        "dingo/api": "dev-master",
        "dingo/blueprint": "@dev",

This is what it's failing on:

     /**
     * Register a User
     *
     * @Post("/user")
     */

If I remove the @Post, it's ok

What other info can I provide?

Thanks

bug duplicate

All 12 comments

@timbroder Can I see what you're controller looks like? Wanna see if I can replicate this

Duplicate of #1079

Hi,
I was facing the same error and searched on google and found this issue that related to the same error.
The solution for this issue for me was writing the documentation of the class itself like this:
`/**

  • Users Resource.
  • @Resource("Users", uri="/users")
    */`
    when I did that everything went well.
    I hope this help anyone facing this issue.
    thanks

I think @mohamed-atef may have been indicating what I found, but i did not catch on at first.
I do not recall if it was like this previously, but the current package REQUIRES that every controller in the api/V1 directory which has a method referenced in the routes.php file under the api section MUST have a resource declaration at the top... you do not have to fill in any endpoints.. but if the declaration is missing from the top, this error will be thrown.

Hi,
I am still getting the same issue with "dingo/api": "1.0.*@dev", and "laravel/lumen-framework": "5.4.*".
Is anyone has any solution?

Thanks,
Anil

+1
Getting same issue in latest release also.

+1

+1 facing the same issue today

+1

+1

Adding a @Versions({"V1"}) annotation fixes it for me.

Most of the times this error comes from syntax error in documentation part on the failing controller.
In some cases when controller extends some other, that already has documentation.

Try to keep it simple.

Basic setup should work, try to add documentation in small amounts:
```

/**

  • # Group DemoController
    *
  • @Resource("", uri="/api")
    */
    class DemoController extends ApiController
    {
/**
 *
 * Login
 *
 * @Post("/demo-login")
 * @Versions({"v1"})
 */
public function login(Request $request)
{
}

}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nghiepit picture nghiepit  路  4Comments

pedrolari picture pedrolari  路  3Comments

BartHuis picture BartHuis  路  3Comments

Kirtsen picture Kirtsen  路  3Comments

adrian-fjellberg picture adrian-fjellberg  路  4Comments