[英]Annotation to show Entity's property description - using nelmioapidocbundle
I am using nelmioapidocbundle in order to documents my Rest API built on the top of symfony-2.x. 我正在使用nelmioapidocbundle来记录建立在symfony-2.x顶部的Rest API。
I can't found the right annotation to use to show each Entity's property description on the return section (Please see bellow attached image). 我找不到用于在返回部分显示每个实体的属性描述的正确注释(请参见下面的附加图像)。
My Entity : 我的实体:
/**
* Checkins
*
* @ORM\Table(name="CheckIns")
* @ORM\Entity(repositoryClass="Project1\ApiBundle\Entity\CheckinsRepository")
*
* @ExclusionPolicy("none")
*/
class Checkins
{
/**
* @var integer
*
* @ORM\Column(name="id", type="bigint", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*
* @Groups({"checkin"})
* @
*/
private $id;
My Controller : 我的控制器:
class CheckinController extends BaseRestController
{
/**
* @ApiDoc(
* resource=true,
* description="Find checkin by ID",
*
* parameters={
* {"name"="categoryId", "dataType"="integer", "required"=true, "description"="checkin id"}
* }
*
* output={
* "class"="Project1\ApiBundle\Entity\Checkins",
* "groups"={"checkin"}
* },
* statusCodes={
* 200="Checkin found",
* 400="ID is required",
* 404="Checkin not found"
* }
* )
*
* @Rest\View()
*/
public function getAction(Request $request)
{}
Result ( Description column is empty ) : 结果(“描述”列为空):
There's a description in doc section of the bundle: 捆绑软件的doc部分中有一个描述:
For classes parsed with JMS metadata, description will be taken from the properties doc comment, if available.
对于使用JMS元数据解析的类,将从属性doc注释(如果有)中进行描述。 For Form Types, you can add an extra option named description on each field
对于表单类型,您可以在每个字段上添加一个名为description的附加选项。
Please visit the following link for more instructions(info at the bottom of the section): 请访问以下链接以获取更多说明(本节底部的信息):
https://github.com/nelmio/NelmioApiDocBundle/blob/master/Resources/doc/index.md#the-apidoc-annotation https://github.com/nelmio/NelmioApiDocBundle/blob/master/Resources/doc/index.md#the-apidoc-annotation
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.