From 5fa69a05045fd0de6fe90f8eead7d107fb8dbbec Mon Sep 17 00:00:00 2001 From: Bez Hermoso Date: Tue, 12 Aug 2014 18:41:23 -0700 Subject: [PATCH] Tests for aliased collections; Swagger formatting for wrapped collections. --- Formatter/SwaggerFormatter.php | 46 +- Swagger/ModelRegistry.php | 17 +- .../Controller/ResourceController.php | 1 + Tests/Formatter/MarkdownFormatterTest.php | 14 + Tests/Formatter/SimpleFormatterTest.php | 35 + Tests/Formatter/SwaggerFormatterTest.php | 790 ++++++++++-------- 6 files changed, 549 insertions(+), 354 deletions(-) diff --git a/Formatter/SwaggerFormatter.php b/Formatter/SwaggerFormatter.php index a8bfe7c..d56316d 100644 --- a/Formatter/SwaggerFormatter.php +++ b/Formatter/SwaggerFormatter.php @@ -11,7 +11,6 @@ namespace Nelmio\ApiDocBundle\Formatter; - use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Nelmio\ApiDocBundle\DataTypes; use Nelmio\ApiDocBundle\Swagger\ModelRegistry; @@ -276,11 +275,44 @@ class SwaggerFormatter implements FormatterInterface $message = sprintf('See standard HTTP status code reason for %s', $statusCode); } - $responseModel = array( - 'code' => $statusCode, - 'message' => $message, - 'responseModel' => $this->registerModel($prop['type']['class'], $prop['model'], ''), - ); + if (isset($prop['type']['collection']) && $prop['type']['collection'] === true) { + + /* + * Without alias: Fully\Qualified\Class\Name[] + * With alias: Fully\Qualified\Class\Name[alias] + */ + $alias = $prop['type']['collectionName']; + + $newName = sprintf('%s[%s]', $prop['type']['class'], $alias); + $collId = + $this->registerModel( + $newName, + array( + $alias => array( + 'dataType' => null, + 'subType' => $prop['type']['class'], + 'actualType' => DataTypes::COLLECTION, + 'required' => true, + 'readonly' => true, + 'description' => null, + 'default' => null, + 'children' => $prop['model'][$alias]['children'], + ) + ), + '' + ); + $responseModel = array( + 'code' => $statusCode, + 'message' => $message, + 'responseModel' => $collId + ); + } else { + $responseModel = array( + 'code' => $statusCode, + 'message' => $message, + 'responseModel' => $this->registerModel($prop['type']['class'], $prop['model'], ''), + ); + } $responseMessages[$statusCode] = $responseModel; } @@ -423,7 +455,7 @@ class SwaggerFormatter implements FormatterInterface $prop['description'] ?: $prop['dataType'] ); $items = array( - '$ref' => $ref, + '$ref' => $ref ); } elseif (isset($this->typeMap[$prop['subType']])) { $items = array('type' => $this->typeMap[$prop['subType']]); diff --git a/Swagger/ModelRegistry.php b/Swagger/ModelRegistry.php index 327a274..3f4ea23 100644 --- a/Swagger/ModelRegistry.php +++ b/Swagger/ModelRegistry.php @@ -130,14 +130,13 @@ class ModelRegistry case DataTypes::COLLECTION: $type = 'array'; - if ($prop['subType'] === DataTypes::MODEL) { - - } else { - - if ($prop['subType'] === null - || isset($this->typeMap[$prop['subType']])) { + if ($prop['subType'] === null) { + $items = array( + 'type' => 'string', + ); + } elseif (isset($this->typeMap[$prop['subType']])) { $items = array( - 'type' => 'string', + 'type' => $this->typeMap[$prop['subType']] ); } elseif (!isset($this->typeMap[$prop['subType']])) { $items = array( @@ -149,7 +148,6 @@ class ModelRegistry ) ); } - } /* @TODO: Handle recursion if subtype is a model. */ break; @@ -213,8 +211,9 @@ class ModelRegistry { /* * Converts \Fully\Qualified\Class\Name to Fully.Qualified.Class.Name + * "[...]" in aliased and non-aliased collections preserved. */ - $id = preg_replace('#(\\\|[^A-Za-z0-9])#', '.', $className); + $id = preg_replace('#(\\\|[^A-Za-z0-9\[\]])#', '.', $className); //Replace duplicate dots. $id = preg_replace('/\.+/', '.', $id); //Replace trailing dots. diff --git a/Tests/Fixtures/Controller/ResourceController.php b/Tests/Fixtures/Controller/ResourceController.php index 74aad93..ec75544 100644 --- a/Tests/Fixtures/Controller/ResourceController.php +++ b/Tests/Fixtures/Controller/ResourceController.php @@ -19,6 +19,7 @@ class ResourceController * resource=true, * resourceDescription="Operations on resource.", * description="List resources.", + * output="array as tests", * statusCodes={200 = "Returned on success.", 404 = "Returned if resource cannot be found."} * ) */ diff --git a/Tests/Formatter/MarkdownFormatterTest.php b/Tests/Formatter/MarkdownFormatterTest.php index bbf59f1..7b5caa1 100644 --- a/Tests/Formatter/MarkdownFormatterTest.php +++ b/Tests/Formatter/MarkdownFormatterTest.php @@ -156,6 +156,20 @@ _List resources._ - Requirement: json|xml|html +#### Response #### + +tests[]: + + * type: array of objects (Test) + +tests[][a]: + + * type: string + +tests[][b]: + + * type: DateTime + ### `POST` /api/resources.{_format} ### diff --git a/Tests/Formatter/SimpleFormatterTest.php b/Tests/Formatter/SimpleFormatterTest.php index f9bcf3d..380b813 100644 --- a/Tests/Formatter/SimpleFormatterTest.php +++ b/Tests/Formatter/SimpleFormatterTest.php @@ -1655,6 +1655,41 @@ With multiple lines.', 'authenticationRoles' => array(), 'deprecated' => false, + 'response' => + array ( + 'tests' => + array ( + 'dataType' => 'array of objects (Test)', + 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\Test', + 'actualType' => 'collection', + 'readonly' => true, + 'required' => true, + 'default' => true, + 'description' => '', + 'children' => + array ( + 'a' => + array ( + 'default' => 'nelmio', + 'actualType' => 'string', + 'subType' => NULL, + 'format' => '{length: min: foo}, {not blank}', + 'required' => true, + 'dataType' => 'string', + 'readonly' => NULL, + ), + 'b' => + array ( + 'default' => NULL, + 'actualType' => 'datetime', + 'subType' => NULL, + 'dataType' => 'DateTime', + 'readonly' => NULL, + 'required' => NULL, + ), + ), + ), + ), ), array( 'method' => 'POST', diff --git a/Tests/Formatter/SwaggerFormatterTest.php b/Tests/Formatter/SwaggerFormatterTest.php index 10d83c7..47d4e56 100644 --- a/Tests/Formatter/SwaggerFormatterTest.php +++ b/Tests/Formatter/SwaggerFormatterTest.php @@ -121,456 +121,546 @@ class SwaggerFormatterTest extends WebTestCase return array( array( '/resources', - array( + array ( 'swaggerVersion' => '1.2', 'apiVersion' => '3.14', 'basePath' => '/api', 'resourcePath' => '/resources', 'apis' => - array( - - array( - 'path' => '/resources.{_format}', - 'operations' => - array( - array( - 'method' => 'GET', - 'summary' => 'List resources.', - 'nickname' => 'get_resources', - 'parameters' => - array( - - array( - 'paramType' => 'path', - 'name' => '_format', - 'type' => 'string', - 'required' => true, - 'enum' => - array( - 'json', - 'xml', - 'html', - ), - ), + array ( + 0 => + array ( + 'path' => '/resources.{_format}', + 'operations' => + array ( + 0 => + array ( + 'method' => 'GET', + 'summary' => 'List resources.', + 'nickname' => 'get_resources', + 'parameters' => + array ( + 0 => + array ( + 'paramType' => 'path', + 'name' => '_format', + 'type' => 'string', + 'required' => true, + 'enum' => + array ( + 0 => 'json', + 1 => 'xml', + 2 => 'html', + ), + ), + ), + 'responseMessages' => + array ( + 0 => + array ( + 'code' => 200, + 'message' => 'Returned on success.', + 'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test[tests]', + ), + 1 => + array ( + 'code' => 404, + 'message' => 'Returned if resource cannot be found.', + ), + ), + 'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test[tests]', ), - 'responseMessages' => - array( - - array( - 'code' => 200, - 'message' => 'Returned on success.', - ), - - array( - 'code' => 404, - 'message' => 'Returned if resource cannot be found.', - ), + 1 => + array ( + 'method' => 'POST', + 'summary' => 'Create a new resource.', + 'nickname' => 'post_resources', + 'parameters' => + array ( + 0 => + array ( + 'paramType' => 'path', + 'name' => '_format', + 'type' => 'string', + 'required' => true, + 'enum' => + array ( + 0 => 'json', + 1 => 'xml', + 2 => 'html', + ), + ), + 1 => + array ( + 'paramType' => 'form', + 'name' => 'a', + 'type' => 'string', + ), + 2 => + array ( + 'paramType' => 'form', + 'name' => 'b', + 'type' => 'number', + 'format' => 'float', + ), + 3 => + array ( + 'paramType' => 'form', + 'name' => 'c', + 'type' => 'string', + 'enum' => + array ( + 0 => 'x', + 1 => 'y', + 2 => 'z', + ), + ), + 4 => + array ( + 'paramType' => 'form', + 'name' => 'd', + 'type' => 'string', + 'format' => 'date-time', + ), + 5 => + array ( + 'paramType' => 'form', + 'name' => 'e', + 'type' => 'string', + 'format' => 'date', + ), + 6 => + array ( + 'paramType' => 'form', + 'name' => 'g', + 'type' => 'string', + ), + ), + 'responseMessages' => + array ( + 0 => + array ( + 'code' => 200, + 'message' => 'See standard HTTP status code reason for 200', + 'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', + ), + ), + 'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', ), ), - - array( - 'method' => 'POST', - 'summary' => 'Create a new resource.', - 'nickname' => 'post_resources', - 'parameters' => - array( - - array( - 'paramType' => 'path', - 'name' => '_format', - 'type' => 'string', - 'required' => true, - 'enum' => - array( - 'json', - 'xml', - 'html', - ), - ), - - array( - 'paramType' => 'form', - 'name' => 'a', - 'type' => 'string', - ), - - array( - 'paramType' => 'form', - 'name' => 'b', - 'type' => 'number', - 'format' => 'float', - ), - - array( - 'paramType' => 'form', - 'name' => 'c', - 'type' => 'string', - 'enum' => - array( - 'x', - 'y', - 'z', - ), - ), - - array( - 'paramType' => 'form', - 'name' => 'd', - 'type' => 'string', - 'format' => 'date-time', - ), - - array( - 'paramType' => 'form', - 'name' => 'e', - 'type' => 'string', - 'format' => 'date', - ), - - array( - 'paramType' => 'form', - 'name' => 'g', - 'type' => 'string', - ), + ), + 1 => + array ( + 'path' => '/resources/{id}.{_format}', + 'operations' => + array ( + 0 => + array ( + 'method' => 'GET', + 'summary' => 'Retrieve a resource by ID.', + 'nickname' => 'get_resources', + 'parameters' => + array ( + 0 => + array ( + 'paramType' => 'path', + 'name' => 'id', + 'type' => 'string', + 'required' => true, + ), + 1 => + array ( + 'paramType' => 'path', + 'name' => '_format', + 'type' => 'string', + 'required' => true, + 'enum' => + array ( + 0 => 'json', + 1 => 'xml', + 2 => 'html', + ), + ), + ), + 'responseMessages' => + array ( + ), ), - 'responseMessages' => - array( - array( - 'code' => 200, - 'message' => 'See standard HTTP status code reason for 200', - 'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', - ), + 1 => + array ( + 'method' => 'DELETE', + 'summary' => 'Delete a resource by ID.', + 'nickname' => 'delete_resources', + 'parameters' => + array ( + 0 => + array ( + 'paramType' => 'path', + 'name' => 'id', + 'type' => 'string', + 'required' => true, + ), + 1 => + array ( + 'paramType' => 'path', + 'name' => '_format', + 'type' => 'string', + 'required' => true, + 'enum' => + array ( + 0 => 'json', + 1 => 'xml', + 2 => 'html', + ), + ), + ), + 'responseMessages' => + array ( + ), ), - 'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', ), - ), - ), - - array( - 'path' => '/resources/{id}.{_format}', - 'operations' => - array( - - array( - 'method' => 'GET', - 'summary' => 'Retrieve a resource by ID.', - 'nickname' => 'get_resources', - 'parameters' => - array( - - array( - 'paramType' => 'path', - 'name' => 'id', - 'type' => 'string', - 'required' => true, - ), - - array( - 'paramType' => 'path', - 'name' => '_format', - 'type' => 'string', - 'required' => true, - 'enum' => - array( - 'json', - 'xml', - 'html', - ), - ), - ), - 'responseMessages' => - array(), - ), - - array( - 'method' => 'DELETE', - 'summary' => 'Delete a resource by ID.', - 'nickname' => 'delete_resources', - 'parameters' => - array( - - array( - 'paramType' => 'path', - 'name' => 'id', - 'type' => 'string', - 'required' => true, - ), - - array( - 'paramType' => 'path', - 'name' => '_format', - 'type' => 'string', - 'required' => true, - 'enum' => - array( - 'json', - 'xml', - 'html', - ), - ), - ), - 'responseMessages' => - array(), - ), - ), - ), + ), ), 'models' => - array( + array ( + 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test' => + array ( + 'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test', + 'description' => NULL, + 'properties' => + array ( + 'a' => + array ( + 'type' => 'string', + 'description' => 'string', + ), + 'b' => + array ( + 'type' => 'string', + 'description' => 'DateTime', + 'format' => 'date-time', + ), + ), + 'required' => + array ( + 0 => 'a', + ), + ), + 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test[tests]' => + array ( + 'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test[tests]', + 'description' => '', + 'properties' => + array ( + 'tests' => + array ( + 'type' => 'array', + 'description' => NULL, + 'items' => + array ( + '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test', + ), + ), + ), + 'required' => + array ( + 0 => 'tests', + ), + ), 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest' => - array( + array ( 'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest', 'description' => 'object (JmsTest)', 'properties' => - array( + array ( 'foo' => - array( + array ( 'type' => 'string', 'description' => 'string', ), 'bar' => - array( + array ( 'type' => 'string', 'description' => 'DateTime', 'format' => 'date-time', ), 'number' => - array( + array ( 'type' => 'number', 'description' => 'double', 'format' => 'float', ), 'arr' => - array( + array ( 'type' => 'array', 'description' => 'array', - 'items' => array( - 'type' => 'string', - ) + 'items' => + array ( + 'type' => 'string', + ), ), 'nested' => - array( + array ( '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', ), 'nested_array' => - array( + array ( 'type' => 'array', 'description' => 'array of objects (JmsNested)', - 'items' => array( - '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', - ) + 'items' => + array ( + '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', + ), ), ), 'required' => - array(), + array ( + ), ), 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' => - array( + array ( 'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', 'description' => '', 'properties' => - array( + array ( 'foo' => - array( + array ( 'type' => 'string', 'description' => 'DateTime', 'format' => 'date-time', ), 'bar' => - array( + array ( 'type' => 'string', 'description' => 'string', ), 'baz' => - array( + array ( 'type' => 'array', 'description' => 'Epic description. With multiple lines.', - 'items' => array( - 'type' => 'string', - ) + 'items' => + array ( + 'type' => 'integer', + ), ), 'circular' => - array( + array ( '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', ), 'parent' => - array( + array ( '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest', ), 'since' => - array( + array ( 'type' => 'string', 'description' => 'string', ), 'until' => - array( + array ( 'type' => 'string', 'description' => 'string', ), 'since_and_until' => - array( + array ( 'type' => 'string', 'description' => 'string', ), ), 'required' => - array(), + array ( + ), ), ), 'produces' => - array(), + array ( + ), 'consumes' => - array(), + array ( + ), 'authorizations' => - array( - 'apiKey' => array( - 'type' => 'apiKey', - 'passAs' => 'header', - 'keyname' => 'access_token', - ) + array ( + 'apiKey' => + array ( + 'type' => 'apiKey', + 'passAs' => 'header', + 'keyname' => 'access_token', + ), ), ), ), array( '/other-resources', - array( + array ( 'swaggerVersion' => '1.2', 'apiVersion' => '3.14', 'basePath' => '/api', 'resourcePath' => '/other-resources', 'apis' => - array( - - array( - 'path' => '/other-resources.{_format}', - 'operations' => - array( - - array( - 'method' => 'GET', - 'summary' => 'List another resource.', - 'nickname' => 'get_other-resources', - 'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest', - 'parameters' => - array( - - array( - 'paramType' => 'path', - 'name' => '_format', - 'type' => 'string', - 'required' => true, - 'enum' => - array( - 'json', - 'xml', - 'html', - ), - ), - ), - 'responseMessages' => - array( - array( - 'code' => 200, - 'message' => 'See standard HTTP status code reason for 200', - 'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest', - ), + array ( + 0 => + array ( + 'path' => '/other-resources.{_format}', + 'operations' => + array ( + 0 => + array ( + 'method' => 'GET', + 'summary' => 'List another resource.', + 'nickname' => 'get_other-resources', + 'parameters' => + array ( + 0 => + array ( + 'paramType' => 'path', + 'name' => '_format', + 'type' => 'string', + 'required' => true, + 'enum' => + array ( + 0 => 'json', + 1 => 'xml', + 2 => 'html', + ), + ), + ), + 'responseMessages' => + array ( + 0 => + array ( + 'code' => 200, + 'message' => 'See standard HTTP status code reason for 200', + 'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest[]', + ), + ), + 'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest[]', ), ), - ), - ), - - array( - 'path' => '/other-resources/{id}.{_format}', - 'operations' => - array( - - array( - 'method' => 'PUT', - 'summary' => 'Update a resource bu ID.', - 'nickname' => 'put_other-resources', - 'parameters' => - array( - - array( - 'paramType' => 'path', - 'name' => 'id', - 'type' => 'string', - 'required' => true, - ), - - array( - 'paramType' => 'path', - 'name' => '_format', - 'type' => 'string', - 'required' => true, - 'enum' => - array( - 'json', - 'xml', - 'html', - ), - ), + ), + 1 => + array ( + 'path' => '/other-resources/{id}.{_format}', + 'operations' => + array ( + 0 => + array ( + 'method' => 'PUT', + 'summary' => 'Update a resource bu ID.', + 'nickname' => 'put_other-resources', + 'parameters' => + array ( + 0 => + array ( + 'paramType' => 'path', + 'name' => 'id', + 'type' => 'string', + 'required' => true, + ), + 1 => + array ( + 'paramType' => 'path', + 'name' => '_format', + 'type' => 'string', + 'required' => true, + 'enum' => + array ( + 0 => 'json', + 1 => 'xml', + 2 => 'html', + ), + ), + ), + 'responseMessages' => + array ( + ), ), - 'responseMessages' => - array(), - ), - - array( - 'method' => 'PATCH', - 'summary' => 'Update a resource bu ID.', - 'nickname' => 'patch_other-resources', - 'parameters' => - array( - - array( - 'paramType' => 'path', - 'name' => 'id', - 'type' => 'string', - 'required' => true, - ), - - array( - 'paramType' => 'path', - 'name' => '_format', - 'type' => 'string', - 'required' => true, - 'enum' => - array( - 'json', - 'xml', - 'html', - ), - ), + 1 => + array ( + 'method' => 'PATCH', + 'summary' => 'Update a resource bu ID.', + 'nickname' => 'patch_other-resources', + 'parameters' => + array ( + 0 => + array ( + 'paramType' => 'path', + 'name' => 'id', + 'type' => 'string', + 'required' => true, + ), + 1 => + array ( + 'paramType' => 'path', + 'name' => '_format', + 'type' => 'string', + 'required' => true, + 'enum' => + array ( + 0 => 'json', + 1 => 'xml', + 2 => 'html', + ), + ), + ), + 'responseMessages' => + array ( + ), ), - 'responseMessages' => - array(), ), - ), - ), + ), ), 'models' => array ( 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest' => array ( 'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest', - 'description' => '', + 'description' => NULL, 'properties' => array ( - '' => + 'foo' => + array ( + 'type' => 'string', + 'description' => 'string', + ), + 'bar' => + array ( + 'type' => 'string', + 'description' => 'DateTime', + 'format' => 'date-time', + ), + 'number' => + array ( + 'type' => 'number', + 'description' => 'double', + 'format' => 'float', + ), + 'arr' => array ( 'type' => 'array', - 'description' => 'array of objects (JmsTest)', + 'description' => 'array', 'items' => array ( - '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest', + 'type' => 'string', + ), + ), + 'nested' => + array ( + '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', + ), + 'nested_array' => + array ( + 'type' => 'array', + 'description' => 'array of objects (JmsNested)', + 'items' => + array ( + '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested', ), ), ), 'required' => array ( - 0 => '', ), ), 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' => @@ -598,7 +688,7 @@ With multiple lines.', With multiple lines.', 'items' => array ( - 'type' => 'string', + 'type' => 'integer', ), ), 'circular' => @@ -629,18 +719,42 @@ With multiple lines.', array ( ), ), + 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest[]' => + array ( + 'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest[]', + 'description' => '', + 'properties' => + array ( + '' => + array ( + 'type' => 'array', + 'description' => NULL, + 'items' => + array ( + '$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest', + ), + ), + ), + 'required' => + array ( + 0 => '', + ), + ), ), 'produces' => - array(), + array ( + ), 'consumes' => - array(), + array ( + ), 'authorizations' => - array( - 'apiKey' => array( - 'type' => 'apiKey', - 'passAs' => 'header', - 'keyname' => 'access_token', - ) + array ( + 'apiKey' => + array ( + 'type' => 'apiKey', + 'passAs' => 'header', + 'keyname' => 'access_token', + ), ), ), ),