mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Tests for aliased collections; Swagger formatting for wrapped collections.
This commit is contained in:
parent
c56aceaef5
commit
5fa69a0504
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Nelmio\ApiDocBundle\Formatter;
|
namespace Nelmio\ApiDocBundle\Formatter;
|
||||||
|
|
||||||
|
|
||||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||||
use Nelmio\ApiDocBundle\DataTypes;
|
use Nelmio\ApiDocBundle\DataTypes;
|
||||||
use Nelmio\ApiDocBundle\Swagger\ModelRegistry;
|
use Nelmio\ApiDocBundle\Swagger\ModelRegistry;
|
||||||
@ -276,11 +275,44 @@ class SwaggerFormatter implements FormatterInterface
|
|||||||
$message = sprintf('See standard HTTP status code reason for %s', $statusCode);
|
$message = sprintf('See standard HTTP status code reason for %s', $statusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(
|
$responseModel = array(
|
||||||
'code' => $statusCode,
|
'code' => $statusCode,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'responseModel' => $this->registerModel($prop['type']['class'], $prop['model'], ''),
|
'responseModel' => $this->registerModel($prop['type']['class'], $prop['model'], ''),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
$responseMessages[$statusCode] = $responseModel;
|
$responseMessages[$statusCode] = $responseModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +455,7 @@ class SwaggerFormatter implements FormatterInterface
|
|||||||
$prop['description'] ?: $prop['dataType']
|
$prop['description'] ?: $prop['dataType']
|
||||||
);
|
);
|
||||||
$items = array(
|
$items = array(
|
||||||
'$ref' => $ref,
|
'$ref' => $ref
|
||||||
);
|
);
|
||||||
} elseif (isset($this->typeMap[$prop['subType']])) {
|
} elseif (isset($this->typeMap[$prop['subType']])) {
|
||||||
$items = array('type' => $this->typeMap[$prop['subType']]);
|
$items = array('type' => $this->typeMap[$prop['subType']]);
|
||||||
|
@ -130,15 +130,14 @@ class ModelRegistry
|
|||||||
case DataTypes::COLLECTION:
|
case DataTypes::COLLECTION:
|
||||||
$type = 'array';
|
$type = 'array';
|
||||||
|
|
||||||
if ($prop['subType'] === DataTypes::MODEL) {
|
if ($prop['subType'] === null) {
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if ($prop['subType'] === null
|
|
||||||
|| isset($this->typeMap[$prop['subType']])) {
|
|
||||||
$items = array(
|
$items = array(
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
);
|
);
|
||||||
|
} elseif (isset($this->typeMap[$prop['subType']])) {
|
||||||
|
$items = array(
|
||||||
|
'type' => $this->typeMap[$prop['subType']]
|
||||||
|
);
|
||||||
} elseif (!isset($this->typeMap[$prop['subType']])) {
|
} elseif (!isset($this->typeMap[$prop['subType']])) {
|
||||||
$items = array(
|
$items = array(
|
||||||
'$ref' =>
|
'$ref' =>
|
||||||
@ -149,7 +148,6 @@ class ModelRegistry
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* @TODO: Handle recursion if subtype is a model. */
|
/* @TODO: Handle recursion if subtype is a model. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -213,8 +211,9 @@ class ModelRegistry
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Converts \Fully\Qualified\Class\Name to Fully.Qualified.Class.Name
|
* 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.
|
//Replace duplicate dots.
|
||||||
$id = preg_replace('/\.+/', '.', $id);
|
$id = preg_replace('/\.+/', '.', $id);
|
||||||
//Replace trailing dots.
|
//Replace trailing dots.
|
||||||
|
@ -19,6 +19,7 @@ class ResourceController
|
|||||||
* resource=true,
|
* resource=true,
|
||||||
* resourceDescription="Operations on resource.",
|
* resourceDescription="Operations on resource.",
|
||||||
* description="List resources.",
|
* description="List resources.",
|
||||||
|
* output="array<Nelmio\ApiDocBundle\Tests\Fixtures\Model\Test> as tests",
|
||||||
* statusCodes={200 = "Returned on success.", 404 = "Returned if resource cannot be found."}
|
* statusCodes={200 = "Returned on success.", 404 = "Returned if resource cannot be found."}
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@ -156,6 +156,20 @@ _List resources._
|
|||||||
|
|
||||||
- Requirement: json|xml|html
|
- Requirement: json|xml|html
|
||||||
|
|
||||||
|
#### Response ####
|
||||||
|
|
||||||
|
tests[]:
|
||||||
|
|
||||||
|
* type: array of objects (Test)
|
||||||
|
|
||||||
|
tests[][a]:
|
||||||
|
|
||||||
|
* type: string
|
||||||
|
|
||||||
|
tests[][b]:
|
||||||
|
|
||||||
|
* type: DateTime
|
||||||
|
|
||||||
|
|
||||||
### `POST` /api/resources.{_format} ###
|
### `POST` /api/resources.{_format} ###
|
||||||
|
|
||||||
|
@ -1655,6 +1655,41 @@ With multiple lines.',
|
|||||||
'authenticationRoles' =>
|
'authenticationRoles' =>
|
||||||
array(),
|
array(),
|
||||||
'deprecated' => false,
|
'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(
|
array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
|
@ -121,121 +121,125 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
'/resources',
|
'/resources',
|
||||||
array(
|
array (
|
||||||
'swaggerVersion' => '1.2',
|
'swaggerVersion' => '1.2',
|
||||||
'apiVersion' => '3.14',
|
'apiVersion' => '3.14',
|
||||||
'basePath' => '/api',
|
'basePath' => '/api',
|
||||||
'resourcePath' => '/resources',
|
'resourcePath' => '/resources',
|
||||||
'apis' =>
|
'apis' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'path' => '/resources.{_format}',
|
'path' => '/resources.{_format}',
|
||||||
'operations' =>
|
'operations' =>
|
||||||
array(
|
array (
|
||||||
array(
|
0 =>
|
||||||
|
array (
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'summary' => 'List resources.',
|
'summary' => 'List resources.',
|
||||||
'nickname' => 'get_resources',
|
'nickname' => 'get_resources',
|
||||||
'parameters' =>
|
'parameters' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => '_format',
|
'name' => '_format',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array (
|
||||||
'json',
|
0 => 'json',
|
||||||
'xml',
|
1 => 'xml',
|
||||||
'html',
|
2 => 'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'Returned on success.',
|
'message' => 'Returned on success.',
|
||||||
|
'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test[tests]',
|
||||||
),
|
),
|
||||||
|
1 =>
|
||||||
array(
|
array (
|
||||||
'code' => 404,
|
'code' => 404,
|
||||||
'message' => 'Returned if resource cannot be found.',
|
'message' => 'Returned if resource cannot be found.',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test[tests]',
|
||||||
),
|
),
|
||||||
|
1 =>
|
||||||
array(
|
array (
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'summary' => 'Create a new resource.',
|
'summary' => 'Create a new resource.',
|
||||||
'nickname' => 'post_resources',
|
'nickname' => 'post_resources',
|
||||||
'parameters' =>
|
'parameters' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => '_format',
|
'name' => '_format',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array (
|
||||||
'json',
|
0 => 'json',
|
||||||
'xml',
|
1 => 'xml',
|
||||||
'html',
|
2 => 'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
1 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'a',
|
'name' => 'a',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
),
|
),
|
||||||
|
2 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'b',
|
'name' => 'b',
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'format' => 'float',
|
'format' => 'float',
|
||||||
),
|
),
|
||||||
|
3 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'c',
|
'name' => 'c',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array (
|
||||||
'x',
|
0 => 'x',
|
||||||
'y',
|
1 => 'y',
|
||||||
'z',
|
2 => 'z',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
4 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'd',
|
'name' => 'd',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'format' => 'date-time',
|
'format' => 'date-time',
|
||||||
),
|
),
|
||||||
|
5 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'e',
|
'name' => 'e',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'format' => 'date',
|
'format' => 'date',
|
||||||
),
|
),
|
||||||
|
6 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'g',
|
'name' => 'g',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array(
|
array (
|
||||||
array(
|
0 =>
|
||||||
|
array (
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'See standard HTTP status code reason for 200',
|
'message' => 'See standard HTTP status code reason for 200',
|
||||||
'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
||||||
@ -245,307 +249,364 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
1 =>
|
||||||
array(
|
array (
|
||||||
'path' => '/resources/{id}.{_format}',
|
'path' => '/resources/{id}.{_format}',
|
||||||
'operations' =>
|
'operations' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'summary' => 'Retrieve a resource by ID.',
|
'summary' => 'Retrieve a resource by ID.',
|
||||||
'nickname' => 'get_resources',
|
'nickname' => 'get_resources',
|
||||||
'parameters' =>
|
'parameters' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => 'id',
|
'name' => 'id',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
),
|
),
|
||||||
|
1 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => '_format',
|
'name' => '_format',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array (
|
||||||
'json',
|
0 => 'json',
|
||||||
'xml',
|
1 => 'xml',
|
||||||
'html',
|
2 => 'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array(),
|
array (
|
||||||
),
|
),
|
||||||
|
),
|
||||||
array(
|
1 =>
|
||||||
|
array (
|
||||||
'method' => 'DELETE',
|
'method' => 'DELETE',
|
||||||
'summary' => 'Delete a resource by ID.',
|
'summary' => 'Delete a resource by ID.',
|
||||||
'nickname' => 'delete_resources',
|
'nickname' => 'delete_resources',
|
||||||
'parameters' =>
|
'parameters' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => 'id',
|
'name' => 'id',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
),
|
),
|
||||||
|
1 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => '_format',
|
'name' => '_format',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array (
|
||||||
'json',
|
0 => 'json',
|
||||||
'xml',
|
1 => 'xml',
|
||||||
'html',
|
2 => 'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array(),
|
array (
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'models' =>
|
'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' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest' =>
|
||||||
array(
|
array (
|
||||||
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
||||||
'description' => 'object (JmsTest)',
|
'description' => 'object (JmsTest)',
|
||||||
'properties' =>
|
'properties' =>
|
||||||
array(
|
array (
|
||||||
'foo' =>
|
'foo' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => 'string',
|
'description' => 'string',
|
||||||
),
|
),
|
||||||
'bar' =>
|
'bar' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => 'DateTime',
|
'description' => 'DateTime',
|
||||||
'format' => 'date-time',
|
'format' => 'date-time',
|
||||||
),
|
),
|
||||||
'number' =>
|
'number' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'number',
|
'type' => 'number',
|
||||||
'description' => 'double',
|
'description' => 'double',
|
||||||
'format' => 'float',
|
'format' => 'float',
|
||||||
),
|
),
|
||||||
'arr' =>
|
'arr' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'description' => 'array',
|
'description' => 'array',
|
||||||
'items' => array(
|
'items' =>
|
||||||
|
array (
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
'nested' =>
|
'nested' =>
|
||||||
array(
|
array (
|
||||||
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
||||||
),
|
),
|
||||||
'nested_array' =>
|
'nested_array' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'description' => 'array of objects (JmsNested)',
|
'description' => 'array of objects (JmsNested)',
|
||||||
'items' => array(
|
'items' =>
|
||||||
|
array (
|
||||||
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'required' =>
|
'required' =>
|
||||||
array(),
|
array (
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' =>
|
||||||
array(
|
array (
|
||||||
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'properties' =>
|
'properties' =>
|
||||||
array(
|
array (
|
||||||
'foo' =>
|
'foo' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => 'DateTime',
|
'description' => 'DateTime',
|
||||||
'format' => 'date-time',
|
'format' => 'date-time',
|
||||||
),
|
),
|
||||||
'bar' =>
|
'bar' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => 'string',
|
'description' => 'string',
|
||||||
),
|
),
|
||||||
'baz' =>
|
'baz' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'description' => 'Epic description.
|
'description' => 'Epic description.
|
||||||
|
|
||||||
With multiple lines.',
|
With multiple lines.',
|
||||||
'items' => array(
|
'items' =>
|
||||||
'type' => 'string',
|
array (
|
||||||
)
|
'type' => 'integer',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'circular' =>
|
'circular' =>
|
||||||
array(
|
array (
|
||||||
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
||||||
),
|
),
|
||||||
'parent' =>
|
'parent' =>
|
||||||
array(
|
array (
|
||||||
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
||||||
),
|
),
|
||||||
'since' =>
|
'since' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => 'string',
|
'description' => 'string',
|
||||||
),
|
),
|
||||||
'until' =>
|
'until' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => 'string',
|
'description' => 'string',
|
||||||
),
|
),
|
||||||
'since_and_until' =>
|
'since_and_until' =>
|
||||||
array(
|
array (
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => 'string',
|
'description' => 'string',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'required' =>
|
'required' =>
|
||||||
array(),
|
array (
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'produces' =>
|
'produces' =>
|
||||||
array(),
|
array (
|
||||||
|
),
|
||||||
'consumes' =>
|
'consumes' =>
|
||||||
array(),
|
array (
|
||||||
|
),
|
||||||
'authorizations' =>
|
'authorizations' =>
|
||||||
array(
|
array (
|
||||||
'apiKey' => array(
|
'apiKey' =>
|
||||||
|
array (
|
||||||
'type' => 'apiKey',
|
'type' => 'apiKey',
|
||||||
'passAs' => 'header',
|
'passAs' => 'header',
|
||||||
'keyname' => 'access_token',
|
'keyname' => 'access_token',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'/other-resources',
|
'/other-resources',
|
||||||
array(
|
array (
|
||||||
'swaggerVersion' => '1.2',
|
'swaggerVersion' => '1.2',
|
||||||
'apiVersion' => '3.14',
|
'apiVersion' => '3.14',
|
||||||
'basePath' => '/api',
|
'basePath' => '/api',
|
||||||
'resourcePath' => '/other-resources',
|
'resourcePath' => '/other-resources',
|
||||||
'apis' =>
|
'apis' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'path' => '/other-resources.{_format}',
|
'path' => '/other-resources.{_format}',
|
||||||
'operations' =>
|
'operations' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'summary' => 'List another resource.',
|
'summary' => 'List another resource.',
|
||||||
'nickname' => 'get_other-resources',
|
'nickname' => 'get_other-resources',
|
||||||
'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
|
||||||
'parameters' =>
|
'parameters' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => '_format',
|
'name' => '_format',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array (
|
||||||
'json',
|
0 => 'json',
|
||||||
'xml',
|
1 => 'xml',
|
||||||
'html',
|
2 => 'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array(
|
array (
|
||||||
array(
|
0 =>
|
||||||
|
array (
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'See standard HTTP status code reason for 200',
|
'message' => 'See standard HTTP status code reason for 200',
|
||||||
'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest[]',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest[]',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
1 =>
|
||||||
),
|
array (
|
||||||
|
|
||||||
array(
|
|
||||||
'path' => '/other-resources/{id}.{_format}',
|
'path' => '/other-resources/{id}.{_format}',
|
||||||
'operations' =>
|
'operations' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
'summary' => 'Update a resource bu ID.',
|
'summary' => 'Update a resource bu ID.',
|
||||||
'nickname' => 'put_other-resources',
|
'nickname' => 'put_other-resources',
|
||||||
'parameters' =>
|
'parameters' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => 'id',
|
'name' => 'id',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
),
|
),
|
||||||
|
1 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => '_format',
|
'name' => '_format',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array (
|
||||||
'json',
|
0 => 'json',
|
||||||
'xml',
|
1 => 'xml',
|
||||||
'html',
|
2 => 'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array(),
|
array (
|
||||||
),
|
),
|
||||||
|
),
|
||||||
array(
|
1 =>
|
||||||
|
array (
|
||||||
'method' => 'PATCH',
|
'method' => 'PATCH',
|
||||||
'summary' => 'Update a resource bu ID.',
|
'summary' => 'Update a resource bu ID.',
|
||||||
'nickname' => 'patch_other-resources',
|
'nickname' => 'patch_other-resources',
|
||||||
'parameters' =>
|
'parameters' =>
|
||||||
array(
|
array (
|
||||||
|
0 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => 'id',
|
'name' => 'id',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
),
|
),
|
||||||
|
1 =>
|
||||||
array(
|
array (
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => '_format',
|
'name' => '_format',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array (
|
||||||
'json',
|
0 => 'json',
|
||||||
'xml',
|
1 => 'xml',
|
||||||
'html',
|
2 => 'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array(),
|
array (
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -555,22 +616,51 @@ With multiple lines.',
|
|||||||
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest' =>
|
||||||
array (
|
array (
|
||||||
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
||||||
'description' => '',
|
'description' => NULL,
|
||||||
'properties' =>
|
'properties' =>
|
||||||
array (
|
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 (
|
array (
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'description' => 'array of objects (JmsTest)',
|
'description' => 'array',
|
||||||
'items' =>
|
'items' =>
|
||||||
array (
|
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' =>
|
'required' =>
|
||||||
array (
|
array (
|
||||||
0 => '',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' =>
|
||||||
@ -598,7 +688,7 @@ With multiple lines.',
|
|||||||
With multiple lines.',
|
With multiple lines.',
|
||||||
'items' =>
|
'items' =>
|
||||||
array (
|
array (
|
||||||
'type' => 'string',
|
'type' => 'integer',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'circular' =>
|
'circular' =>
|
||||||
@ -629,18 +719,42 @@ With multiple lines.',
|
|||||||
array (
|
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' =>
|
'produces' =>
|
||||||
array(),
|
array (
|
||||||
|
),
|
||||||
'consumes' =>
|
'consumes' =>
|
||||||
array(),
|
array (
|
||||||
|
),
|
||||||
'authorizations' =>
|
'authorizations' =>
|
||||||
array(
|
array (
|
||||||
'apiKey' => array(
|
'apiKey' =>
|
||||||
|
array (
|
||||||
'type' => 'apiKey',
|
'type' => 'apiKey',
|
||||||
'passAs' => 'header',
|
'passAs' => 'header',
|
||||||
'keyname' => 'access_token',
|
'keyname' => 'access_token',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user