我使用nelmioapidocbundle来记录构建在symfony-2.x之上的Rest API。
我找不到正确的注释来显示每个实体的属性描述在返回部分(请参阅下面附加的图像)。
我的实体:
/**
* 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;我的财务主任:
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)
{}结果(说明栏为空):

发布于 2015-05-07 12:24:22
bundle的doc部分有一个描述:
对于使用JMS元数据解析的类,如果可用,将从属性文档注释中获取描述。对于表单类型,可以在每个字段中添加一个名为description的额外选项。
请访问以下链接以获得更多说明(本节底部的信息):
https://stackoverflow.com/questions/26853838
复制相似问题