He integrado swagger php api outr rest-api, todos los servicios funcionan bien, pero tengo un problema en la matriz post json en api. esto no funciona por favor me pueden ayudar.
Aquí mi código api swagger
/** * @SWG\Post(path="/createbetsnap/get_all_game_data", * tags={"Create Betsnaps Section"}, * summary="This function used to get selected tournament schedule date and other master data like size, prize structure and entry fee", * description="", * operationId="get_all_game_data", * produces={"application/json"}, * consumes={"application/json"}, * @SWG\Parameter( * name="Login_Session_Key", * in="header", * description="The Login Session Key of logged in user.", * required=true, * type="string" * ), * @SWG\Parameter( * name="game_tournament", * in="formData", * description="The game tournament ids array field.", * required=true, * type="array", * @SWG\Items(type="string") * ), * @SWG\Response(response=200, description="success message with data array"), * @SWG\Response(response=500, description="Invalid username/password supplied") * ) */código completo anterior en swagger que agregué antes de mi api.
Quiero publicar el campo game_tournament como
{"game_tournament":["18","8"]}Pero desde la publicación del panel swagger-ui en el siguiente formato
game_tournament=8,18¿Pueden ayudarme, por favor, qué está mal con mi código, qué necesito cambiar?
Gracias de antemano.
usando, por ejemplo, el paquete Swagger Lume para Laravel / Lumen, puede obtener lo que está pidiendo al:
* @OA\Parameter( * name="game_tournament[]", * in="query", * description="The game tournament ids array field", * required=true, * @OA\Schema(type="array", @OA\Items(type="string")), * ),Para publicar datos JSON, debe usar un parámetro in: body y especificar el tipo de datos usando @SWG\Schema :
* @SWG\Parameter( * name="game_tournament", * in="body", * description="The game tournament ids array field.", * required=true, * @SWG\Schema( * type="array", * @SWG\Items(type="string") * ) * ),Solo inténtalo:
* @SWG\Parameter( * name="game_tournament[]", * type="array", * items="string", * collectionFormat="multi", * required=true, * in="query", * ),