我如何在 Swagger 文档中将对象作为参数发送
How can i send an object as a parameter in Swagger Documentation
我正在使用 Swagger 来记录我的 Lumen API 并且我正在使用注释。问题是,我不知道如何实现你可以在图片上看到的带有注释的结构
谁能帮我解决这个问题?
我终于找到了答案以及如何获得我想要的结构:
@OA\RequestBody(
* @OA\JsonContent(
* type="object",
* @OA\Property(property="idNumber", type="string"),
* @OA\Property(property="ClientId", type="string"),
* @OA\Property(property="inspection", type="array",
* @OA\Items(type="object", properties = {
* @OA\Property(property="Color", type="string"),
* @OA\Property(property="time", type="string"),
* @OA\Property(property="place", type="string"),
* @OA\Property(property="issue", type="string"),
* @OA\Property(property="details", type="string"),
* }),
* ),
* @OA\Property(property="detailId", type="string"),
* @OA\Property(property="WayPayment", type="array",
* @OA\Items(type="object", properties = {
* @OA\Property(property="banking", type="string"),
* @OA\Property(property="numbercard", type="string"),
* @OA\Property(property="numberpayment", type="string"),
* }),
* ),
* ),
* ),
我正在使用 Swagger 来记录我的 Lumen API 并且我正在使用注释。问题是,我不知道如何实现你可以在图片上看到的带有注释的结构
谁能帮我解决这个问题?
我终于找到了答案以及如何获得我想要的结构:
@OA\RequestBody(
* @OA\JsonContent(
* type="object",
* @OA\Property(property="idNumber", type="string"),
* @OA\Property(property="ClientId", type="string"),
* @OA\Property(property="inspection", type="array",
* @OA\Items(type="object", properties = {
* @OA\Property(property="Color", type="string"),
* @OA\Property(property="time", type="string"),
* @OA\Property(property="place", type="string"),
* @OA\Property(property="issue", type="string"),
* @OA\Property(property="details", type="string"),
* }),
* ),
* @OA\Property(property="detailId", type="string"),
* @OA\Property(property="WayPayment", type="array",
* @OA\Items(type="object", properties = {
* @OA\Property(property="banking", type="string"),
* @OA\Property(property="numbercard", type="string"),
* @OA\Property(property="numberpayment", type="string"),
* }),
* ),
* ),
* ),