Doctrine / Swagger-php Syntax error: [Syntax Error] Expected PlainValue, got ')' at position [closed]

StackOverflow https://stackoverflow.com/questions/21272027

Domanda

I'm trying to use Swagger-php, but I keep getting the error

Via bash: [username@dev swagger-php]$ ./bin/swagger [path to codeigniter controller dir]/controllers -o [targetoutput path]/swagger

The Swagger setup is in the original vendor dir as it was downloaded

[WARN] [Syntax Error] Expected PlainValue, got ')' at position 546 in Tools_Data->tool_get(...) in /usr/local/apache2/htdocs/jh-intranet/application/controllers/v1/tools_data.php on line 27.
[ERROR] no valid resources found

Line 27 is /**
Line 28 is * @SWG\Resource(

There is a syntax error, but looks like not at that line. I've checked multiple sources for info online, but can't seem to get rid of the error. There are no single quotes, and the open/close parenthesis match. It'd be nice if there was a Swagger/Doctrine annotations lint for this sort of thing.

What should I explore next?

Doc / Code excerpt:

use Swagger\Annotations as SWG;
/**
 * @package
 * @category
 * @subpackage
 *
 * @SWG\Model(id="Tool",required="id")
 */
class Tools_Data extends REST_Controller
{

    function __construct()
    {
        parent::__construct();
    }

/**
 * @SWG\Resource(
 *      resourcePath="/v1/tool_data/tool",
 *      @SWG\Api(
 *          path="/v1/tool_data/tool/toolId",
 *          @SWG\Operation(
 *              method="GET", 
 *              summary="Find tool by ID or other filters", 
 *              notes="Returns tool listing",
 *              type="Tools", 
 *              nickname="getTools", 
 *              @SWG\Parameters(
 *                  @SWG\Parameter(
 *                      name="id",
 *                      paramType="path",
 *                      format="int",
 *                      required="false",
 *                      description="Tool ID",
 *                      notes="Can also be a JSON parameter",
 *                  )
 *                  @SWG\Parameter(
 *                      name="clean",
 *                      paramType="query",
 *                      format="bool",
 *                      required="false",
 *                      description="Returns a reduced field listing",
 *                      notes="Returns date_added,title,id,tool_tab_id,resource_id,last_modified  omits published",
 *                  )
 *              )
 *          )
 *      )
 * )
 */

Edit: Working/Corrected Annotation:

/**
 * @SWG\Resource(
 *      resourcePath="/v1/tool_data/tool",
 *      @SWG\Api(
 *          path="/v1/tool_data/tool/toolId",
 *          @SWG\Operation(
 *              method="GET", 
 *              summary="Find tool by ID or other filters", 
 *              notes="Returns tool listing",
 *              type="Tools", 
 *              nickname="getTools",
 *              @SWG\Parameters(
 *                  @SWG\Parameter(
 *                      name="id",
 *                      paramType="path",
 *                      format="int",
 *                      required=false,
 *                      description="Tool ID"
 *                  ),
 *                  @SWG\Parameter(
 *                      name="clean",
 *                      paramType="query",
 *                      format="bool",
 *                      required=false,
 *                      description="Returns a reduced field listing"
 *                  )
 *              )
 *          )
 *      )
 * )
 */
È stato utile?

Soluzione

There is a comma after omits published" so doctrine is surprised to see a ) at character 546 of the comment that starts on line 27.

If you find a linter let me know, i'd also like to have more descriptive error messages.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top