[FAQ] swagger-php @OA\JsonContent 与 @MediaType @OA\Schema 的用法
@OA\JsonContent 是对 @MediaType @OA\Schema 两者的封装,类似于 laravel 中 JsonResponse 对 Response 的封装。
@OA\JsonContent 例子:
* @OA\Response( * response=200, * description="failure data", * @OA\JsonContent( * type="object", * @OA\Property(property="data", default=""), * @OA\Property(property="message", type="string", default="xx not correct"), * @OA\Property(property="code", type="integer", default=-1) * ) * ),
@MediaType 和 @OA\Schema 例子:
* @OA\Response( * response=200, * description="success data", * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * @OA\Property(property="data", type="object", * @OA\Property(property="token", type="string") * ), * @OA\Property(property="message", default="success"), * @OA\Property(property="code", type="integer") * ) * ) * ),
Doc:https://zircote.github.io/swagger-php/Getting-started.html#shortcuts