简体   繁体   English

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

[英]Swagger Laravel 5 - [Semantical Error] Couldn't find constant name

Can anyone help clear this error please? 任何人都可以帮助清除此错误吗? I'm using latrell\\swagger for Laravel and I've defined this on one of my models: 我正在为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 {

However, when I go to build the docs, it returns this: 但是,当我去构建文档时,它返回以下内容:

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

Does anyone have an idea of how I can fix this? 有谁知道我该如何解决? I've got other models which (apart from names/variables etc) are identical, and they're fine. 我有其他模型(除了名称/变量等)是相同的,它们很好。 I've checked google and no helpful info is reported. 我已经检查过Google,没有任何有用的信息报告。 I'm just off to check sources and figure this out, but in the meantime thought I'd ask. 我只是要检查来源并找出答案,但与此同时我想问一下。

Cheers. 干杯。

Sussed it. 暂停了 Were a couple of issues: 有几个问题:

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

Firstly name= was incorrect and lastly I'd missed a quote mark from the format field. 首先name=不正确,最后我错过了format字段中的引号。

Some slightly better error responses would've been helpful. 一些稍微更好的错误响应会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM