Swagger Laravel 5 - [语义错误]无法找到常量名称

时间:2015-07-23 11:30:35

标签: php laravel-5 swagger

有人可以帮忙清除此错误吗?我在Laravel上使用latrell \ swagger,我在我的一个模型上定义了这个:

use Swagger\Annotations as SWG;

/**
 * @SWG\Parameter(
 *      partial="body_recipienttag",
 *      name="body",
 *      description="Recipient Tag to be created",
 *      type="RecipientTag",
 *      paramType="body",
 *      required=true,
 *      allowMultiple=false
 * )
 * @SWG\Model(id="RecipientTag")
 *
 * @SWG\Property(name="id",type="integer",format="int64",description="Unique identifier for the recipient tag")
 * @SWG\Property(name="name", type="string", description="The name of this recipient tag")
 * @SWG\Property(name="recipient_tag_group_id", type="integer", format="int64", description="The recipient tag group id this tag belongs to")
 * @SWG\Property(name="location_id", type="integer", format="int64", description="The location id this tag belongs to")
 * @SWG\Property(name-"location_group_id", type="integer", format="int64, description="The location group id this tag belongs to")
 * @SWG\Property(name="created_at",type="string",format="date-format",description="Date this interaction was created")
 * @SWG\Property(name="deleted_at",type="string",format="date-format",description="Date this interaction was deleted")
 * @SWG\Property(name="updated_at",type="string",format="date-format",description="Date this interaction was last updated")
 */
class RecipientTag extends Model {

然而,当我去构建文档时,它会返回:

vagrant@homestead:~/Code$ php /home/vagrant/Code/vendor/zircote/swagger-php/swagger.phar app -o public/apidocs
Swagger-PHP 1.0.0
-----------------
[WARN] [Semantical Error] Couldn't find constant name, /home/vagrant/Code/app/Api/Tags/Recipient/RecipientTag.php on line 8.
[INFO] Partial "body_recipienttag" not found.
[INFO] Partial "body_recipienttag" not found.
Created public/apidocs/api-docs.json
Skipped public/apidocs/index.php
Created public/apidocs/as_testing.json
Created public/apidocs/closedloop.json
Created public/apidocs/interactions.json
Created public/apidocs/interactiontype.json
Created public/apidocs/location.json
Created public/apidocs/steps.json
Created public/apidocs/tag_recipient.json

有没有人知道如何解决这个问题?我有其他模型(除了名称/变量等)是相同的,它们很好。我查了谷歌,没有报道任何有用的信息。我只是去查看消息来源并想出来,但同时我想我会问。

干杯。

1 个答案:

答案 0 :(得分:1)

怀疑它。有几个问题:

* @SWG\Property(name-"location_group_id", type="integer", format="int64, description...

首先name=不正确,最后我错过了format字段中的引号。

稍微好一点的错误回复会有所帮助。