diff --git a/src/Service.php b/src/Service.php index 9c60ca4..0f6001b 100644 --- a/src/Service.php +++ b/src/Service.php @@ -261,6 +261,7 @@ private function getPathOperation(Operation $operation, $parameters) { return $this->cleanEmptyValues([ 'tags' => [$this->service->getName()], + 'operationId' => $operation->getIdentifier(), 'description' => $operation->getDescription(), 'parameters' => $parameters, 'produces' => $this->service->getRequestAcceptTypes(), diff --git a/test/TestAsset/fixtures/swagger2.json b/test/TestAsset/fixtures/swagger2.json index 52384b9..ffd5c92 100644 --- a/test/TestAsset/fixtures/swagger2.json +++ b/test/TestAsset/fixtures/swagger2.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "Test", - "version": "1.0" + "version": "1" }, "tags": [{ "name": "BooBaz" @@ -283,6 +283,7 @@ }, "/foo-bar": { "get": { + "operationId": "listFooBar", "tags": ["FooBar"], "description": "Collection FooBar GET!", "produces": [ @@ -759,6 +760,7 @@ }, "/ping": { "get": { + "operationId": "ping", "tags": ["Ping"], "description": "Ping the API to see uptime and network lag", "produces": [ diff --git a/test/TestAsset/module-config/documentation.config.php b/test/TestAsset/module-config/documentation.config.php index 3e862d3..9f86db9 100644 --- a/test/TestAsset/module-config/documentation.config.php +++ b/test/TestAsset/module-config/documentation.config.php @@ -8,6 +8,7 @@ 'Test\\V1\\Rest\\FooBar\\Controller' => [ 'collection' => [ 'GET' => [ + 'identifier' => 'listFooBar', 'description' => 'Collection FooBar GET!', 'request' => null, 'response' => '{ @@ -44,6 +45,7 @@ }', ], 'POST' => [ + 'identifier' => null, 'description' => null, 'request' => '{ "goober": "Example goober value", @@ -55,21 +57,25 @@ ], 'entity' => [ 'GET' => [ + 'identifier' => null, 'description' => null, 'request' => null, 'response' => null, ], 'PATCH' => [ + 'identifier' => null, 'description' => null, 'request' => null, 'response' => null, ], 'PUT' => [ + 'identifier' => null, 'description' => null, 'request' => null, 'response' => null, ], 'DELETE' => [ + 'identifier' => null, 'description' => null, 'request' => null, 'response' => null, @@ -83,6 +89,7 @@ ], 'Test\\V1\\Rpc\\Ping\\Controller' => [ 'GET' => [ + 'identifier' => 'ping', 'description' => 'Ping the API to see uptime and network lag', 'request' => null, 'response' => '{"ack": 123456789}',