Skip to content

L5-swagger config doesn't support swagger-php option to add multiple servers / base URLs #601

Description

@vibonacci
  • L5-Swagger Version: 8.5
  • PHP Version 8.3
  • OS: N.A.

Description:

OpenApi 3.x, swagger-php and swagger-ui support multiple servers / base URLs to be defined.

However, l5-swagger.php config file will not accept an array - or anything else for that matter - to have multiple servers end up in the servers array in the open-api-docs.json.

I've tried in l5-swagger.php:

           /*
             * Edit to set the api's base path
            */
            'base' => env('L5_SWAGGER_BASE_PATH', [
                ['url' => env('API_URL')],
                ['url' => env('APP_URL')],
            ]),

            /*
             * Edit to set the api's base path
            */
            'base' => env('L5_SWAGGER_BASE_PATH', [
                env('API_URL'),
                env('APP_URL'),
            ]),

Both do not result in the proper structure:

    "servers": [
        {
            "url": [
                "http://localhost/api",
                "http://localhost"
            ]
        }
    ],

afbeelding

    "servers": [
        {
            "url": [
                {
                    "url": "http://localhost/api"
                },
                {
                    "url": "http://localhost"
                }
            ]
        }
    ],

Could support for this be added? It is quite useful.
Or this there another way to hook into the open-api-docs.json generation to add it manually in the meantime?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions