NoGall
NoGall

Reputation: 5246

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:

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. I'm just off to check sources and figure this out, but in the meantime thought I'd ask.

Cheers.

Upvotes: 1

Views: 6827

Answers (1)

NoGall
NoGall

Reputation: 5246

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.

Some slightly better error responses would've been helpful.

Upvotes: 1

Related Questions