duanjiong1952 2018-11-14 10:34
浏览 535
已采纳

Swagger for PHP数组数组

I am trying to create a response example that should return an array like this:

[
  [
    "Shop Name",
    "53.7094190",
    "-1.9084720"
    ,1
  ]
]

For this I am using this code:

*   @OA\Response(
*     response= "default",
*     description="Success: Array of shops",
*     @OA\MediaType(
*       mediaType="text/plain",
*         @OA\Schema(
*           type = "array",
*           @OA\Items( type="array",
*              @OA\Items(type="string", default="'Bridge Balti','53.7094190','-1.9084720',1"),
*           ),
*         )
*     )
*   )

And I am getting this in swagger hub:

[
  [
    "string"
  ]
]
  • 写回答

1条回答 默认 最新

  • dongshi1914 2018-12-21 11:23
    关注

    If you just want to display an example in swagger ui, then you need to use the "example" parameter.

    @OA\Items(type="string",example="'Bridge Balti','53.7094190','-1.9084720',1")

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?