0

How we can change Request URL for swagger in lumen as shown in image

I have tried to change SWAGGER_LUME_CONST_HOST but no use

and when trying to set L5_SWAGGER_BASE_PATH from config/swagger-lume.php file then gives error as Unexpected field "basePath" for @OA\OpenApi(), expecting "openapi", "info", "servers", "paths", "components", "security", "tags", "extern
alDocs", "x" in

In base controller added as

     <?php

namespace App\Http\Controllers;

use Laravel\Lumen\Routing\Controller as BaseController;

/** @OA\Info(title="API", version="0.1") */
/**
 * @OA\Swagger(
 *     basePath="",
 *     schemes={"http", "https"},
 *     host=L5_SWAGGER_CONST_HOST,
 *     @SWG\Info(
 *         version="1.0.0",
 *         title="L5 Swagger API",
 *         description="L5 Swagger API description",
 *         @SWG\Contact(
 *             email="your-email@domain.com"
 *         ),
 *     )
 * )
 */
class Controller extends BaseController
{
    //
}

In sample example controller code as

<?php
 
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
class TestController extends Controller
{
  /**
* @OA\Get(
 *  path="/api/testing/{mytest}",
 *  operationId="testing",
 *  summary="Get Testing",
 *       @OA\Parameter(
     *          name="mytest",
     *          in="path",
     *          required=true, 
     *      ),
     *   @OA\Response(response=200, description="successful operation"),
     *   @OA\Response(response=406, description="not acceptable"),
     *   @OA\Response(response=500, description="internal server error"),

 * )
 */




 

    public function index(Request $request){
        echo $request->mytest;
    }
}
Satish A
  • 1
  • 2

0 Answers0