简体   繁体   中英

Swagger sending empty post requests

I just set up swagger for laravel 5.1 (old project) I wrote entire documentation for my project but the problem is that when I go Try it out! It sends empty requests. And when I try the exact same thing with postman it works like its supposed to.

This is an example:

 /**
 * @SWG\Post(
 *     path="/api-routes/verify-report",
 *     consumes={"multipart/form-data"},
 *     description="Verify report",
 *     operationId="verifyReport",
 *     @SWG\Parameter(
 *         description="Application report id",
 *         format="int64",
 *         in="path",
 *         name="report_id",
 *         required=true,
 *         type="string"
 *     ),           
 *     produces={"application/json"},
 *     @SWG\Response(
 *         response="200",
 *         description="successful operation"
 *     ),
 *     summary="Verify report",
 *     tags={
 *         "Verify report"
 *     }
 * )
 * */
public function verifyReport() {

}

And I'm using

"darkaonline/l5-swagger": "~3.0"

You just need to change few changes like this bellow.

/**
 * @SWG\Post(
 *     path="/api-routes/verify-report",
 *     consumes={"multipart/form-data"},
 *     description="Verify report",
 *     operationId="verifyReport",
 *     consumes={"application/x-www-form-urlencoded"},
 *     produces={"application/json"},
 *     @SWG\Parameter(
 *         description="Application report id",
 *         in="forData",
 *         name="report_id",
 *         required=false,
 *         type="string"
 *     ), 
 *     @SWG\Response(
 *         response="200",
 *         description="successful operation"
 *     ),
 *     summary="Verify report",
 *     tags={
 *         "Verify report"
 *     }
 * )
 * */
public function verifyReport() {

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM