diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 85ed1b3..67fac69 100755 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -6,6 +6,7 @@ use Illuminate\Http\Request; use Illuminate\Http\Testing\File; use Illuminate\Support\Arr; +use Illuminate\Support\Facades\URL; use Illuminate\Support\Str; use ReflectionClass; use RonasIT\AutoDoc\Exceptions\DocFileNotExistsException; @@ -140,7 +141,7 @@ protected function generateEmptyData(): array $data = [ 'openapi' => self::OPEN_API_VERSION, 'servers' => [ - ['url' => $this->getAppUrl() . $this->config['basePath']], + ['url' => URL::query($this->config['basePath'])], ], 'paths' => [], 'components' => [ @@ -158,13 +159,6 @@ protected function generateEmptyData(): array return $data; } - protected function getAppUrl(): string - { - $url = config('app.url'); - - return str_replace(['http://', 'https://', '/'], '', $url); - } - protected function generateSecurityDefinition(): ?array { if (empty($this->security)) { diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_get_route_parameters_description.json b/tests/fixtures/SwaggerServiceTest/tmp_data_get_route_parameters_description.json index 1590e34..4f177cd 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_get_route_parameters_description.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_get_route_parameters_description.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": { diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_and_info.json b/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_and_info.json index e6bd61b..9c2985a 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_and_info.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_and_info.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": [], diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_jwt.json b/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_jwt.json index 016ecee..2c994d3 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_jwt.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_jwt.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": [], diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_laravel.json b/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_laravel.json index 69e4487..53b5b5a 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_laravel.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_laravel.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": [], diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_query.json b/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_query.json index 70d0162..8b95d9c 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_query.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_request_with_empty_data_query.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": [], diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_closure_request.json b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_closure_request.json index a0ec5c3..d6f077a 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_closure_request.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_closure_request.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": { diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request.json b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request.json index 813d24d..064333e 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": { diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_jwt_security.json b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_jwt_security.json index a6d8d26..e58ee18 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_jwt_security.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_jwt_security.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": { diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_laravel_security.json b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_laravel_security.json index 8f546f7..d45826f 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_laravel_security.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_laravel_security.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": { diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_query_security.json b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_query_security.json index 0b15494..3cdbaa5 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_query_security.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_search_roles_request_query_security.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "servers": [ { - "url": "localhost/" + "url": "http://localhost" } ], "paths": {