如何使Laravel Swagger自动检测注释?

时间:2019-05-29 10:20:04

标签: php laravel swagger

我想在我的Laravel API上使用Swagger,但是我不想为我的每个控制器和API都做注释。网上有一些软件包,例如DarkOline和其他软件包,但我认为它们没有像.netcore这样的自动检测功能,它可以自动识别控制器中的所有参数并为它们大摇大摆!所以我的意思是我不希望这样的注释如下:

    /**
 * @SWG\Get(
 *      path="/get-accommodation-facilities",
 *      operationId="getAccommodationFacilityList",
 *      tags={"AccommodationFacilityById"},
 *      summary="Get list of accommodation facility By Id",
 *      description="Returns list of accommodationFacility by thier accommodation Id",
 *      operationId="findaccommodationfacilityByIdTags",
 * @SWG\Response(
 *     response=200,
 *     description="Success",
 *     @SWG\Schema(
 *             title="AccommodationFacility",
 *          @SWG\Property(type="integer", property="accommodation_facility_type_id", description="accommodation_facility_type_id"),
 *          @SWG\Property(type="string", property="name", description="name"),
 *          @SWG\Property(type="string", property="english_name", description="english_name"),
 *          @SWG\Property(type="integer", property="is_deleted", description="is_deleted"),
 *     )
 * ),
 *       @SWG\Response(response=404, description="Not Found"),
 *       security={
 *           {"api_key_security_example": {}}
 *       }
 *
 *     )
 *
 * Returns list of accommodations
 */

我有100种api,所以我不能为它们中的每一个做它,因为它们也接受一些嵌套对象!

0 个答案:

没有答案