简体   繁体   English

在NelmioApiDocBundle中设置“参数”注释

[英]Set 'parameters' annotation in NelmioApiDocBundle

I create an API RESTfull using Symfony2.1 with FOSRESTBundle and I am using NelmioApiDocBundle to generate automatic documentation. 我使用Symfony2.1和FOSRESTBundle创建API RESTfull,并且使用NelmioApiDocBundle生成自动文档。

I have a PUT request in which the user should send one parameter, but I don't need to create a Form for this purpose. 我有一个PUT请求,用户应该在其中发送一个参数,但是我不需要为此创建一个Form。 All works perfectly but when I generate the documentation I don't know how to add this parameter to the documentation because I don't have a 'input' form. 一切正常,但是当我生成文档时,我不知道如何将此参数添加到文档中,因为我没有“输入”表单。

I tried this but seems doesn't work: 我尝试了这个,但似乎不起作用:

 /**
 * @ApiDoc(
 *  description="description",
 *  statusCodes={
 *         200="Success",
 *         400="Bad request"},
 *  parameters={
 *         {"name"="parameter_name", "dataType"="integer"}
 *  }
 * )
 ...

In the documentation of NelmioApiDocBundle I didn't see any solution for this... NelmioApiDocBundle的文档中,我没有找到任何解决方案...

use filters key instead of parameters 使用过滤器键而不是参数

 * filters={
 *     {"name"="parameter_name", "dataType"="integer"},
 * },

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

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