1

我正在尝试使用 Slim 编写一个小 Api。我想让它记录得很好,所以我安装了 swagger-php 和 UI 并在最后几天对其进行了调查。出于某种原因,我的 petstore 演示缺少所有帖子注释。我的 API 将如下例所示:

http://coenraets.org/blog/2011/12/restful-services-with-jquery-php-and-the-slim-framework/

addWine() 函数的招摇注解会是什么样子?我如何注释函数的结果(最后插入 id),因为它不是模型?

一个例子真的很棒。谢谢

4

1 回答 1

0

这样就可以了。可能不会像这样,而是做我想做的事。

/**
* @package
* @category
* @subpackage
*
* @SWG\Resource(
*   apiVersion="1.0.0",
*   swaggerVersion="1.2",
*   basePath="http://myapi",
*   resourcePath="/hello",
*   description="Giving you your name in case you forgot it",
*   produces="['application/json','application/xml','text/plain','text/html']"
* )
*/

/**
 * @SWG\Api(
 *   path="/hello/{yourname}",
 *   @SWG\Operation(
 *     method="GET",
 *     summary="Gives you your name",
 *     notes="Returns your name",
 *     type="hello",
 *     nickname="yourname",
 *     @SWG\Parameter(
 *       name="yourname",
 *       description="Enter your name",
 *       required=true,
 *       type="text",
 *       paramType="path"
 *     ),
 *     @SWG\ResponseMessage(code=404, message="Bad, really bad name.")
 *   )
 * )
 *
     */ 

 /**
     * @package
     * @category
     * @subpackage
     *
     * @SWG\Model(id="hello",required="name")
     */

/**
 * @SWG\Property(name="name",type="string",description="Your name")
 */  
于 2014-05-04T20:07:31.657 回答