Swagger and json-rpc

自作多情 提交于 2019-12-11 07:32:17

问题


I'm trying to use Swagger-ui for my json-rpc server which was written by php. I use Swagger-PHP to generate json complaint container for Swagger-ui. So, I'm very new to Swagger and I use annotation for methods like that:

/**
 *  @SWG\Resource(
 *      apiVersion="0.2",
 *      swaggerVersion="0.8",
 *      basePath="http://mydomain.com",
 *      @SWG\Api(
 *          path="/rpc/json/server.php",
 *          description="Operations about Devices",
 *          @SWG\Operations(
 *              @SWG\Operation(
 *                  method="POST",
 *                  summary="Get device by ID",
 *                  nickname="getDevice",
 *                  @SWG\Parameters(
 *                      @SWG\Parameter(
 *                          name="deviceID",
 *                          description="device id",
 *                          required="true",
 *                          type="string"
 *                      )
 *                  ),
 *                  @SWG\ResponseMessages(
 *                      @SWG\ResponseMessage(code=404, message="Device not found")
 *                  )
 *              )
 *          )
 *      )
 *  )
*/

In SWG\Operation I need to add one more "method" in correspondence with json-rpc spec. As a result all requests will use POST method as part of http and json container will have its own "method" for each one.

The question - where should I start searching to solve this issue?

Sorry for my English. Not native.


回答1:


Add additional @SWG\Operation()s inside the @SWG\Api() or @SWG\Operations()

I've added an example which demonstrates multiple operations in one @SWG\Api().

Does this answer your question?, i'm not familiar with the json-rpc spec.



来源:https://stackoverflow.com/questions/19618800/swagger-and-json-rpc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!