@Apostol63

Как сделать многомерный массив в swagger-php?

Всем доброго времени суток

Вопрос к тем, кто работал с swagger-php
Я пишу через него документацию. Во всех примерах, которые я нашел, присутствуют простейшие параметры. Но если мне нужно сделать многомерный массив, то там уже ничего нет
Мой код
/**
     *Send Email method
     * @OA\Post (
     *     path="/v1/sendEmail",
     *     operationId="sendEmail",
     *     summary="Send email",
     *     description="",
     *     @OA\RequestBody(
     *         @OA\MediaType(
     *             mediaType="application/json",
     *             @OA\Schema(
     *                 type="array",
     *                 @OA\Items(
     *                     @OA\Property(
     *                         property="action",
     *                         type="string",
     *                     ),
     *                 ),
     *             ),
     *         ),
     *     ),
     *     @OA\Response(
     *         response=200,
     *         description="OK",
     *         @OA\MediaType(
     *             mediaType="application/json",
     *             @OA\Schema(
     *                 @OA\Property(
     *                     property="result",
     *                     type="string"
     *                 ),
     *                 @OA\Property(
     *                     property="message",
     *                     type="string"
     *                 ),
     *                 example={"result": "Ok", "message": "Success"}
     *             )
     *         )
     *     )
     * )
     *
     *
     *
     * @param Request $request
     * @return JsonResponse
     */
    public function sendEmail(Request $request): JsonResponse
    {
        return response()->json('ok');
    }


После свойства action должен идти массив letter со своими значениями внутри и вот как раз это самый массив у меня не получается создать.

Заранее спасибо
  • Вопрос задан
  • 1167 просмотров
Пригласить эксперта
Ответы на вопрос 1
@Kerm
Может кому пригодится
/**
     * @OA\Property(
     *     title="rootCauses",
     *     description="rootCauses",
     *     format="array",
     *     example=1,
     *     @OA\Items(
     *          type="object",
     *          @OA\Property(
     *             property="id",
     *             type="integer"
     *          ),
     *          @OA\Property(
     *            property="name",
     *            type="string"
     *          ,
     *          @OA\Property(
     *            property="values",
     *            type="array",
     *            @OA\Items(
     *               type="object",
     *               @OA\Property(
     *                  property="id",
     *                  type="integer"
     *               ),
     *              @OA\Property(
     *                  property="name",
     *                  type="string",
     *              ),
     *          ),
     *     ),
     * )
     *
     * @var array
     */
    public $rootCauses;
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы