Swagger UI on array string

Viewed 31
@OA\RequestBody(
     *       @OA\MediaType(
     *           mediaType="multipart/form-data",
     *           @OA\Schema(
     *               @OA\Property(
     *                  description ="nama file",
     *                  property="nm_file",
     *                  type="array",
     *                  @OA\Items(
     *                       type="string",
     *                  ),
     *               ),
     *              @OA\Property(
     *                  description ="file",
     *                  property="file[]",
     *                  type="array",
     *                  @OA\Items(
     *                       type="string",
     *                       format="binary",
     *                  ),
     *               ),
     *           ),
     *       )
     *   ),

wanna ask some question quys why i get nm_file = "string_a,string_b" instead of nm_file = "string_a","string_b"

1 Answers

Well you wanted everything inside the array to be a string, but as I see you are looking for an object. So do it like this

 * @OA\Property(
 *   description ="nama file",
 *   property="nm_file",
 *   type="array",
 *   @OA\Items(type="object",
 *     @OA\Property(property="someString", type="string", example="test 
 *       string"),
 *   ),
 * ),
Related