diff --git a/src/Lib/Path/PathFromRouteFactory.php b/src/Lib/Path/PathFromRouteFactory.php index 124b52f0..03f0423e 100644 --- a/src/Lib/Path/PathFromRouteFactory.php +++ b/src/Lib/Path/PathFromRouteFactory.php @@ -53,7 +53,7 @@ public function create(): ?Path return null; } - $path = (new Path())->setResource($this->getResourceName()); + $path = (new Path())->setResource($this->route->templateToOpenApiPath()); $swagPath = $this->getSwagPathAnnotation($fqn); @@ -91,42 +91,4 @@ private function getSwagPathAnnotation(string $fqns): ?SwagPath return reset($results); } - - /** - * Returns a routes resource (e.g. /api/model/action) - * - * @return string - */ - private function getResourceName(): string - { - $pieces = $this->getRoutablePieces(); - - if ($this->config->getPrefix() == '/') { - return implode('/', $pieces); - } - - return substr( - implode('/', $pieces), - strlen($this->config->getPrefix()) - ); - } - - /** - * Splits the route (URL) into pieces with forward-slash "/" as the separator after removing path variables - * - * @return string[] - */ - private function getRoutablePieces(): array - { - return array_map( - function ($piece) { - if (substr($piece, 0, 1) == ':') { - return '{' . str_replace(':', '', $piece) . '}'; - } - - return $piece; - }, - explode('/', $this->route->getTemplate()) - ); - } } diff --git a/src/Lib/Route/RouteDecorator.php b/src/Lib/Route/RouteDecorator.php index da626224..555f0222 100644 --- a/src/Lib/Route/RouteDecorator.php +++ b/src/Lib/Route/RouteDecorator.php @@ -228,4 +228,25 @@ public function setControllerFqn(string $controllerFqn) return $this; } + + /** + * Converts a CakePHP route template to an OpenAPI path + * + * @return string + */ + public function templateToOpenApiPath(): string + { + $pieces = array_map( + function ($piece) { + if (substr($piece, 0, 1) == ':') { + return '{' . str_replace(':', '', $piece) . '}'; + } + + return $piece; + }, + explode('/', $this->template) + ); + + return implode('/', $pieces); + } } diff --git a/src/Lib/Swagger.php b/src/Lib/Swagger.php index 9e8f7c8e..ff8780e4 100644 --- a/src/Lib/Swagger.php +++ b/src/Lib/Swagger.php @@ -320,7 +320,7 @@ private function buildPathsFromRoutes(): void $ignorePaths = array_keys($this->array['paths']); foreach ($routes as $route) { - $resource = $this->convertCakePathToOpenApiResource($route->getTemplate()); + $resource = $route->templateToOpenApiPath(); if ($this->hasPathByResource($resource)) { $path = $this->array['paths'][$resource]; @@ -399,36 +399,6 @@ private function buildSchemaFromYml(): void } } - /** - * Converts Cake path parameters to OpenApi Spec - * - * @example /actor/:id to /actor/{id} - * @param string $resource Resource name - * @return string - */ - private function convertCakePathToOpenApiResource(string $resource): string - { - $pieces = array_map( - function ($piece) { - if (substr($piece, 0, 1) == ':') { - return '{' . str_replace(':', '', $piece) . '}'; - } - - return $piece; - }, - explode('/', $resource) - ); - - if ($this->config->getPrefix() == '/') { - return implode('/', $pieces); - } - - return substr( - implode('/', $pieces), - strlen($this->config->getPrefix()) - ); - } - /** * Returns an array of Operation objects that do not have a 200-299 HTTP status code * diff --git a/tests/TestCase/Command/InstallCommandTest.php b/tests/TestCase/Command/InstallCommandTest.php index 55f7bb4d..981060de 100644 --- a/tests/TestCase/Command/InstallCommandTest.php +++ b/tests/TestCase/Command/InstallCommandTest.php @@ -27,7 +27,7 @@ public function setUp() : void public function testExecute() { - $this->exec('swagger install --config_test ' . $this->configDir, ['Y','/api']); + $this->exec('swagger install --config_test ' . $this->configDir, ['Y','/']); $this->assertOutputContains('Installation Complete!'); $this->assertFileExists($this->configDir . 'swagger.yml'); $this->assertFileExists($this->configDir . 'swagger_bake.php'); @@ -42,7 +42,7 @@ public function testExecuteWithExitDoNotOverwriteExisting() public function testExecuteFileCopyFails() { - $this->exec('swagger install --config_test /config/no-exists', ['Y','/api']); + $this->exec('swagger install --config_test /config/no-exists', ['Y','/']); $this->assertExitError(); } diff --git a/tests/TestCase/Lib/Annotations/SwagDtoTest.php b/tests/TestCase/Lib/Annotations/SwagDtoTest.php index 7915aa1b..1beb71a4 100644 --- a/tests/TestCase/Lib/Annotations/SwagDtoTest.php +++ b/tests/TestCase/Lib/Annotations/SwagDtoTest.php @@ -24,7 +24,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'only' => ['dtoPost','dtoQuery'], @@ -45,7 +45,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagEntityAttributeTest.php b/tests/TestCase/Lib/Annotations/SwagEntityAttributeTest.php index b1eeccb6..58ae5219 100644 --- a/tests/TestCase/Lib/Annotations/SwagEntityAttributeTest.php +++ b/tests/TestCase/Lib/Annotations/SwagEntityAttributeTest.php @@ -26,14 +26,14 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees'); }); $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagEntityTest.php b/tests/TestCase/Lib/Annotations/SwagEntityTest.php index e5c20e6c..4662e87f 100644 --- a/tests/TestCase/Lib/Annotations/SwagEntityTest.php +++ b/tests/TestCase/Lib/Annotations/SwagEntityTest.php @@ -36,7 +36,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', function (RouteBuilder $routes) { $routes->resources('EmployeeSalaries'); @@ -46,7 +46,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagFormTest.php b/tests/TestCase/Lib/Annotations/SwagFormTest.php index 0320a1df..d1335069 100644 --- a/tests/TestCase/Lib/Annotations/SwagFormTest.php +++ b/tests/TestCase/Lib/Annotations/SwagFormTest.php @@ -24,7 +24,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'map' => [ @@ -39,7 +39,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagHeaderTest.php b/tests/TestCase/Lib/Annotations/SwagHeaderTest.php index f0edceb9..0a13218f 100644 --- a/tests/TestCase/Lib/Annotations/SwagHeaderTest.php +++ b/tests/TestCase/Lib/Annotations/SwagHeaderTest.php @@ -24,7 +24,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'map' => [ @@ -39,7 +39,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagOperationTest.php b/tests/TestCase/Lib/Annotations/SwagOperationTest.php index 14a92973..fb63ffd2 100644 --- a/tests/TestCase/Lib/Annotations/SwagOperationTest.php +++ b/tests/TestCase/Lib/Annotations/SwagOperationTest.php @@ -37,7 +37,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Operations', [ 'map' => [ @@ -61,7 +61,7 @@ public function setUp(): void $this->router = $router; $this->config = [ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagPaginatorTest.php b/tests/TestCase/Lib/Annotations/SwagPaginatorTest.php index d5337658..8b42bb4e 100644 --- a/tests/TestCase/Lib/Annotations/SwagPaginatorTest.php +++ b/tests/TestCase/Lib/Annotations/SwagPaginatorTest.php @@ -24,14 +24,14 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Departments'); }); $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagPathParameterTest.php b/tests/TestCase/Lib/Annotations/SwagPathParameterTest.php index d9ac779a..5f8b3ee3 100644 --- a/tests/TestCase/Lib/Annotations/SwagPathParameterTest.php +++ b/tests/TestCase/Lib/Annotations/SwagPathParameterTest.php @@ -23,7 +23,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('OperationPath', [ 'only' => ['pathParameter'], @@ -39,7 +39,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagPathTest.php b/tests/TestCase/Lib/Annotations/SwagPathTest.php index 484d800a..2d425cbe 100644 --- a/tests/TestCase/Lib/Annotations/SwagPathTest.php +++ b/tests/TestCase/Lib/Annotations/SwagPathTest.php @@ -32,7 +32,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', function (RouteBuilder $routes) { $routes->resources('EmployeeTitles'); @@ -41,7 +41,7 @@ public function setUp(): void $this->router = $router; $this->config = [ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagQueryTest.php b/tests/TestCase/Lib/Annotations/SwagQueryTest.php index 2c4fac1e..30ec53d1 100644 --- a/tests/TestCase/Lib/Annotations/SwagQueryTest.php +++ b/tests/TestCase/Lib/Annotations/SwagQueryTest.php @@ -24,14 +24,14 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Departments'); }); $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagRequestBodyContentTest.php b/tests/TestCase/Lib/Annotations/SwagRequestBodyContentTest.php index e540a895..ea39018f 100644 --- a/tests/TestCase/Lib/Annotations/SwagRequestBodyContentTest.php +++ b/tests/TestCase/Lib/Annotations/SwagRequestBodyContentTest.php @@ -24,7 +24,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('SwagRequestBodyContent', [ 'map' => [ @@ -49,7 +49,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagRequestBodyTest.php b/tests/TestCase/Lib/Annotations/SwagRequestBodyTest.php index 82df06ce..cf3c32d9 100644 --- a/tests/TestCase/Lib/Annotations/SwagRequestBodyTest.php +++ b/tests/TestCase/Lib/Annotations/SwagRequestBodyTest.php @@ -24,7 +24,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'map' => [ @@ -39,7 +39,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagResponseSchemaTest.php b/tests/TestCase/Lib/Annotations/SwagResponseSchemaTest.php index 05cfe254..9534f200 100644 --- a/tests/TestCase/Lib/Annotations/SwagResponseSchemaTest.php +++ b/tests/TestCase/Lib/Annotations/SwagResponseSchemaTest.php @@ -32,7 +32,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'map' => [ @@ -52,7 +52,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-with-existing.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Annotations/SwagSecurityTest.php b/tests/TestCase/Lib/Annotations/SwagSecurityTest.php index 84042ad8..dcc9b243 100644 --- a/tests/TestCase/Lib/Annotations/SwagSecurityTest.php +++ b/tests/TestCase/Lib/Annotations/SwagSecurityTest.php @@ -24,7 +24,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'map' => [ @@ -39,7 +39,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Extension/CakeSearch/ExtensionTest.php b/tests/TestCase/Lib/Extension/CakeSearch/ExtensionTest.php index b315b199..b18abc3d 100644 --- a/tests/TestCase/Lib/Extension/CakeSearch/ExtensionTest.php +++ b/tests/TestCase/Lib/Extension/CakeSearch/ExtensionTest.php @@ -30,7 +30,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'only' => ['swagSearch'], @@ -46,7 +46,7 @@ public function setUp(): void $this->router = $router; $this->config = [ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Operation/OperationFromRouteFactoryTest.php b/tests/TestCase/Lib/Operation/OperationFromRouteFactoryTest.php index b02b41d7..60696b88 100644 --- a/tests/TestCase/Lib/Operation/OperationFromRouteFactoryTest.php +++ b/tests/TestCase/Lib/Operation/OperationFromRouteFactoryTest.php @@ -24,7 +24,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'only' => ['index','update'] @@ -33,7 +33,7 @@ public function setUp(): void $this->router = $router; $this->config = [ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Operation/OperationPathTest.php b/tests/TestCase/Lib/Operation/OperationPathTest.php index bfbb1bb2..098b1bb8 100644 --- a/tests/TestCase/Lib/Operation/OperationPathTest.php +++ b/tests/TestCase/Lib/Operation/OperationPathTest.php @@ -13,7 +13,7 @@ class OperationPathTest extends TestCase public function testGetOperationWithHeaders() { $routeDecorator = new RouteDecorator( - new Route('/api/employees/:id', [ + new Route('//employees/:id', [ '_method' => ['GET'], 'plugin' => '', 'controller' => 'Employees', diff --git a/tests/TestCase/Lib/Operation/OperationRequestBodyTest.php b/tests/TestCase/Lib/Operation/OperationRequestBodyTest.php index 16dfed45..43f3f956 100644 --- a/tests/TestCase/Lib/Operation/OperationRequestBodyTest.php +++ b/tests/TestCase/Lib/Operation/OperationRequestBodyTest.php @@ -31,7 +31,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'only' => ['create'] @@ -40,7 +40,7 @@ public function setUp(): void $this->router = $router; $this->config = [ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Operation/OperationResponseTest.php b/tests/TestCase/Lib/Operation/OperationResponseTest.php index ec3428e2..9cecbf81 100644 --- a/tests/TestCase/Lib/Operation/OperationResponseTest.php +++ b/tests/TestCase/Lib/Operation/OperationResponseTest.php @@ -40,7 +40,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'only' => [ @@ -68,7 +68,7 @@ public function setUp(): void if (!$this->config instanceof Configuration) { $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Operation/OperationSecurityTest.php b/tests/TestCase/Lib/Operation/OperationSecurityTest.php index c27aacf4..0d582d1d 100644 --- a/tests/TestCase/Lib/Operation/OperationSecurityTest.php +++ b/tests/TestCase/Lib/Operation/OperationSecurityTest.php @@ -27,7 +27,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'only' => 'index' @@ -35,7 +35,7 @@ public function setUp(): void }); $this->config = [ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', @@ -51,7 +51,7 @@ public function setUp(): void ]; $this->routeDecorator = new RouteDecorator( - new Route('/api/employees/:id', [ + new Route('//employees/:id', [ '_method' => ['GET'], 'plugin' => '', 'controller' => 'Employees', diff --git a/tests/TestCase/Lib/Path/PathFromRouteFactoryTest.php b/tests/TestCase/Lib/Path/PathFromRouteFactoryTest.php index c03e4a2f..ad9c5c66 100644 --- a/tests/TestCase/Lib/Path/PathFromRouteFactoryTest.php +++ b/tests/TestCase/Lib/Path/PathFromRouteFactoryTest.php @@ -20,7 +20,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'only' => 'index' @@ -29,7 +29,7 @@ public function setUp(): void $this->router = $router; $this->config = [ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/Schema/SchemaFactoryTest.php b/tests/TestCase/Lib/Schema/SchemaFactoryTest.php index 89406a3e..35dafe65 100644 --- a/tests/TestCase/Lib/Schema/SchemaFactoryTest.php +++ b/tests/TestCase/Lib/Schema/SchemaFactoryTest.php @@ -25,7 +25,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $this->configuration = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/SwaggerOperationTest.php b/tests/TestCase/Lib/SwaggerOperationTest.php index b12952bf..88b15b43 100644 --- a/tests/TestCase/Lib/SwaggerOperationTest.php +++ b/tests/TestCase/Lib/SwaggerOperationTest.php @@ -43,7 +43,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'map' => [ @@ -62,7 +62,7 @@ public function setUp(): void $this->router = $router; $this->config = [ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-bare-bones.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/SwaggerSchemaTest.php b/tests/TestCase/Lib/SwaggerSchemaTest.php index d2f5c0a1..57e1912c 100644 --- a/tests/TestCase/Lib/SwaggerSchemaTest.php +++ b/tests/TestCase/Lib/SwaggerSchemaTest.php @@ -23,7 +23,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees'); $builder->resources('EmployeeSalaries'); @@ -31,7 +31,7 @@ public function setUp(): void $this->router = $router; $this->config = new Configuration([ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-with-existing.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/TestCase/Lib/SwaggerTest.php b/tests/TestCase/Lib/SwaggerTest.php index 8c660df4..9c43dcc2 100644 --- a/tests/TestCase/Lib/SwaggerTest.php +++ b/tests/TestCase/Lib/SwaggerTest.php @@ -28,7 +28,7 @@ public function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $router = new Router(); - $router::scope('/api', function (RouteBuilder $builder) { + $router::scope('/', function (RouteBuilder $builder) { $builder->setExtensions(['json']); $builder->resources('Employees', [ 'map' => [ @@ -51,7 +51,7 @@ public function setUp(): void $this->router = $router; $this->config = [ - 'prefix' => '/api', + 'prefix' => '/', 'yml' => '/config/swagger-with-existing.yml', 'json' => '/webroot/swagger.json', 'webPath' => '/swagger.json', diff --git a/tests/test_app/config/swagger-bare-bones-two-security-schemes.yml b/tests/test_app/config/swagger-bare-bones-two-security-schemes.yml index 7440ac29..6a4c2aa2 100644 --- a/tests/test_app/config/swagger-bare-bones-two-security-schemes.yml +++ b/tests/test_app/config/swagger-bare-bones-two-security-schemes.yml @@ -4,8 +4,6 @@ info: title: Swagger Bakery license: name: MIT -servers: - - url: /api components: securitySchemes: BearerAuth: diff --git a/tests/test_app/config/swagger-bare-bones.yml b/tests/test_app/config/swagger-bare-bones.yml index 2047dc9c..095f94bc 100644 --- a/tests/test_app/config/swagger-bare-bones.yml +++ b/tests/test_app/config/swagger-bare-bones.yml @@ -4,8 +4,6 @@ info: title: Swagger Bakery license: name: MIT -servers: - - url: /api components: securitySchemes: BearerAuth: diff --git a/tests/test_app/config/swagger-with-existing.yml b/tests/test_app/config/swagger-with-existing.yml index 9843aafc..8c2c305f 100644 --- a/tests/test_app/config/swagger-with-existing.yml +++ b/tests/test_app/config/swagger-with-existing.yml @@ -4,8 +4,6 @@ info: title: Swagger Bakery license: name: MIT -servers: - - url: /api paths: /employee-salaries: get: diff --git a/tests/test_app/config/swagger.yml b/tests/test_app/config/swagger.yml index 9302d939..e49d55cc 100644 --- a/tests/test_app/config/swagger.yml +++ b/tests/test_app/config/swagger.yml @@ -4,8 +4,6 @@ info: title: Swagger Bakery license: name: MIT -servers: - - url: /api components: securitySchemes: BearerAuth: