私はswagger uiを使用しており、オプションのパラメーターを取るGet APIを持っていますが、以下のAPIに注釈を付けることができません。私が試したmakeコードです:
/**
* @SWG\Get(
* path="/basics/checkDataNameAvailability/{type}/{name}{/id}",
* tags={"Emergency"},
* description="Return data useful for userGroup, deviceGroups and deviceTags",
* produces={"application/json", "application/xml", "text/xml", "text/html"},
* @SWG\Parameter(name="type",in="path",description="return useful data by type",required=true,type="integer", @SWG\Items(type="integer"),collectionFormat="csv",format="int32"),
* @SWG\Parameter(name="name",in="path",description="return useful data by name",required=true,type="integer", @SWG\Items(type="integer"),collectionFormat="csv",format="int32"),
* @SWG\Parameter(name="id",in="path",description="optional, useful data by id",required=true,type="integer", @SWG\Items(type="integer"),collectionFormat="csv",format="int32"),
* @SWG\Response(response=200,description="Dashboard Response",
* @SWG\Schema(type="array",@SWG\Items(ref="#/definitions/Pet"))
* ),
* @SWG\Response(response="default",description="unexpected error",
* @SWG\Schema(ref="#/definitions/ErrorModel")
* ),
* @SWG\ExternalDocumentation(description="find more info here", url="https://swagger.io/about")
* )
*/
私のGet API構造は次のようなものです:
$app->get('/checkDataNameAvailability/:type/:name(/:id)', function($type, $name, $id = '') use($app){
//here is my api code
});
しかし、私がこれを試しているとき、swagger ui はidオプションのパラメーターを取りません。必要なパラメーターを取ります。助けてください..