GGAMI.NET

laravel 에서 L5-Swagger 패키지 사용할때 path 추가하기

Updated on

https://github.com/DarkaOnLine/L5-Swagger 사용해서

laravel swagger 사용할때 api/docs 말고 다른 path 추가하고싶을때가 있다.

'mcp' => [ 'api' => [ 'title' => 'MCP', ], 'routes' => [ /* * Route for accessing api documentation interface */ 'api' => 'api/mcp/docs', 'docs' => 'docs-mcp', 'oauth2_callback' => 'api/oauth2-callback-mcp', ], 'paths' => [ /* * Edit to include full URL in ui for assets */ 'use_absolute_path' => env('L5_SWAGGER_USE_ABSOLUTE_PATH', true), /* * Edit to set path where swagger ui assets should be stored */ 'swagger_ui_assets_path' => env('L5_SWAGGER_UI_ASSETS_PATH', 'vendor/swagger-api/swagger-ui/dist/'), /* * File name of the generated json documentation file */ 'docs_json' => 'api-docs.json', /* * File name of the generated YAML documentation file */ 'docs_yaml' => 'api-docs.yaml', /* * Set this to `json` or `yaml` to determine which documentation file to use in UI */ 'format_to_use_for_docs' => env('L5_FORMAT_TO_USE_FOR_DOCS', 'json'), /* * Absolute paths to directory containing the swagger annotations are stored. */ 'annotations' => [ base_path('app'), ], 'docs' => storage_path('api-docs-mcp'), ], 'generate_always' => false, ],

위 내용 처럼 해주면 된다.

그러면 이렇게 된다.

다른 글