mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Form errors parser. Mirrored actual form-errors response by FOSRest. Made sure that FieldErrors is not duplicated.
This commit is contained in:
parent
6d50c200ba
commit
859421df9a
@ -275,6 +275,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$className = !empty($prop['type']['form_errors']) ? $prop['type']['class'] . '.ErrorResponse' : $prop['type']['class'];
|
||||||
|
|
||||||
if (isset($prop['type']['collection']) && $prop['type']['collection'] === true) {
|
if (isset($prop['type']['collection']) && $prop['type']['collection'] === true) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -283,14 +285,14 @@ class SwaggerFormatter implements FormatterInterface
|
|||||||
*/
|
*/
|
||||||
$alias = $prop['type']['collectionName'];
|
$alias = $prop['type']['collectionName'];
|
||||||
|
|
||||||
$newName = sprintf('%s[%s]', $prop['type']['class'], $alias);
|
$newName = sprintf('%s[%s]', $className, $alias);
|
||||||
$collId =
|
$collId =
|
||||||
$this->registerModel(
|
$this->registerModel(
|
||||||
$newName,
|
$newName,
|
||||||
array(
|
array(
|
||||||
$alias => array(
|
$alias => array(
|
||||||
'dataType' => null,
|
'dataType' => null,
|
||||||
'subType' => $prop['type']['class'],
|
'subType' => $className,
|
||||||
'actualType' => DataTypes::COLLECTION,
|
'actualType' => DataTypes::COLLECTION,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
@ -307,10 +309,11 @@ class SwaggerFormatter implements FormatterInterface
|
|||||||
'responseModel' => $collId
|
'responseModel' => $collId
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$responseModel = array(
|
$responseModel = array(
|
||||||
'code' => $statusCode,
|
'code' => $statusCode,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'responseModel' => $this->registerModel($prop['type']['class'], $prop['model'], ''),
|
'responseModel' => $this->registerModel($className, $prop['model'], ''),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$responseMessages[$statusCode] = $responseModel;
|
$responseMessages[$statusCode] = $responseModel;
|
||||||
|
128
Parser/FormErrorsParser.php
Normal file
128
Parser/FormErrorsParser.php
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the NelmioApiDocBundle.
|
||||||
|
*
|
||||||
|
* (c) Nelmio <hello@nelm.io>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Nelmio\ApiDocBundle\Parser;
|
||||||
|
|
||||||
|
use Nelmio\ApiDocBundle\DataTypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bez Hermoso <bezalelhermoso@gmail.com>
|
||||||
|
*/
|
||||||
|
class FormErrorsParser implements ParserInterface, PostParserInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Return true/false whether this class supports parsing the given class.
|
||||||
|
*
|
||||||
|
* @param array $item containing the following fields: class, groups. Of which groups is optional
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function supports(array $item)
|
||||||
|
{
|
||||||
|
return isset($item['form_errors']) && $item['form_errors'] === true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function parse(array $item)
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides the root parameters to contain these parameters instead:
|
||||||
|
* - status_code: 400
|
||||||
|
* - message: "Validation failed"
|
||||||
|
* - errors: contains the original parameters, but all types are changed to array of strings (array of errors for each field)
|
||||||
|
*
|
||||||
|
* @param array $item
|
||||||
|
* @param array $parameters
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function postParse(array $item, array $parameters)
|
||||||
|
{
|
||||||
|
$params = $parameters;
|
||||||
|
|
||||||
|
foreach ($params as $name => $data) {
|
||||||
|
$params[$name] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$params['status_code'] = array(
|
||||||
|
'dataType' => 'integer',
|
||||||
|
'actualType' => DataTypes::INTEGER,
|
||||||
|
'subType' => null,
|
||||||
|
'required' => false,
|
||||||
|
'description' => 'The status code',
|
||||||
|
'readonly' => true,
|
||||||
|
'default' => 400,
|
||||||
|
);
|
||||||
|
|
||||||
|
$params['message'] = array(
|
||||||
|
'dataType' => 'string',
|
||||||
|
'actualType' => DataTypes::STRING,
|
||||||
|
'subType' => null,
|
||||||
|
'required' => false,
|
||||||
|
'description' => 'The error message',
|
||||||
|
'default' => 'Validation failed.',
|
||||||
|
);
|
||||||
|
|
||||||
|
$params['errors'] = array(
|
||||||
|
'dataType' => 'errors',
|
||||||
|
'actualType' => DataTypes::MODEL,
|
||||||
|
'subType' => sprintf('%s.FormErrors', $item['class']),
|
||||||
|
'required' => false,
|
||||||
|
'description' => 'Errors',
|
||||||
|
'readonly' => true,
|
||||||
|
'children' => $this->doPostParse($parameters),
|
||||||
|
);
|
||||||
|
|
||||||
|
return $params;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function doPostParse(array $parameters, $attachFieldErrors = true, array $propertyPath = array())
|
||||||
|
{
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
foreach ($parameters as $name => $parameter) {
|
||||||
|
|
||||||
|
$data[$name] = array(
|
||||||
|
'dataType' => 'parameter errors',
|
||||||
|
'actualType' => DataTypes::MODEL,
|
||||||
|
'subType' => 'FieldErrors',
|
||||||
|
'required' => false,
|
||||||
|
'description' => 'Errors on the parameter',
|
||||||
|
'readonly' => true,
|
||||||
|
'children' => array(
|
||||||
|
'errors' => array(
|
||||||
|
'dataType' => 'array of errors',
|
||||||
|
'actualType' => DataTypes::COLLECTION,
|
||||||
|
'subType' => 'string',
|
||||||
|
'required' => false,
|
||||||
|
'dscription' => '',
|
||||||
|
'readonly' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($parameter['actualType'] === DataTypes::MODEL) {
|
||||||
|
$propertyPath[] = $name;
|
||||||
|
$data[$name]['subType'] = sprintf('%s.FieldErrors[%s]', $parameter['subType'], implode('.', $propertyPath));
|
||||||
|
$data[$name]['children'] = $this->doPostParse($parameter['children'], $attachFieldErrors, $propertyPath);
|
||||||
|
} else {
|
||||||
|
if ($attachFieldErrors === false) {
|
||||||
|
unset($data[$name]['children']);
|
||||||
|
}
|
||||||
|
$attachFieldErrors = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@
|
|||||||
<parameter key="nelmio_api_doc.extractor.handler.phpdoc.class">Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler</parameter>
|
<parameter key="nelmio_api_doc.extractor.handler.phpdoc.class">Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler</parameter>
|
||||||
|
|
||||||
<parameter key="nelmio_api_doc.parser.collection_parser.class">Nelmio\ApiDocBundle\Parser\CollectionParser</parameter>
|
<parameter key="nelmio_api_doc.parser.collection_parser.class">Nelmio\ApiDocBundle\Parser\CollectionParser</parameter>
|
||||||
|
<parameter key="nelmio_api_doc.parser.form_errors_parser.class">Nelmio\ApiDocBundle\Parser\FormErrorsParser</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
<services>
|
<services>
|
||||||
@ -58,6 +59,9 @@
|
|||||||
<service id="nelmio_api_doc.parser.collection_parser" class="%nelmio_api_doc.parser.collection_parser.class%">
|
<service id="nelmio_api_doc.parser.collection_parser" class="%nelmio_api_doc.parser.collection_parser.class%">
|
||||||
<tag name="nelmio_api_doc.extractor.parser" />
|
<tag name="nelmio_api_doc.extractor.parser" />
|
||||||
</service>
|
</service>
|
||||||
|
<service id="nelmio_api_doc.parser.form_errors_parser" class="%nelmio_api_doc.parser.form_errors_parser.class%">
|
||||||
|
<tag name="nelmio_api_doc.extractor.parser" />
|
||||||
|
</service>
|
||||||
</services>
|
</services>
|
||||||
|
|
||||||
</container>
|
</container>
|
||||||
|
@ -48,7 +48,10 @@ class ResourceController
|
|||||||
* @ApiDoc(
|
* @ApiDoc(
|
||||||
* description="Create a new resource.",
|
* description="Create a new resource.",
|
||||||
* input={"class" = "Nelmio\ApiDocBundle\Tests\Fixtures\Form\SimpleType", "name" = ""},
|
* input={"class" = "Nelmio\ApiDocBundle\Tests\Fixtures\Form\SimpleType", "name" = ""},
|
||||||
* output="Nelmio\ApiDocBundle\Tests\Fixtures\Model\JmsNested"
|
* output="Nelmio\ApiDocBundle\Tests\Fixtures\Model\JmsNested",
|
||||||
|
* responseMap={
|
||||||
|
* 400 = {"class" = "Nelmio\ApiDocBundle\Tests\Fixtures\Form\SimpleType", "form_errors" = true}
|
||||||
|
* }
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function createResourceAction()
|
public function createResourceAction()
|
||||||
|
@ -16,6 +16,7 @@ use Nelmio\ApiDocBundle\Tests\WebTestCase;
|
|||||||
*/
|
*/
|
||||||
class SwaggerFormatterTest extends WebTestCase
|
class SwaggerFormatterTest extends WebTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ApiDocExtractor
|
* @var ApiDocExtractor
|
||||||
*/
|
*/
|
||||||
@ -79,19 +80,19 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'path' => '/tests',
|
'path' => '/tests',
|
||||||
'description' => NULL,
|
'description' => null,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'path' => '/tests',
|
'path' => '/tests',
|
||||||
'description' => NULL,
|
'description' => null,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'path' => '/tests2',
|
'path' => '/tests2',
|
||||||
'description' => NULL,
|
'description' => null,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'path' => '/TestResource',
|
'path' => '/TestResource',
|
||||||
'description' => NULL,
|
'description' => null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -128,19 +129,19 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
'resourcePath' => '/resources',
|
'resourcePath' => '/resources',
|
||||||
'apis' =>
|
'apis' =>
|
||||||
array(
|
array(
|
||||||
0 =>
|
|
||||||
array(
|
array(
|
||||||
'path' => '/resources.{_format}',
|
'path' => '/resources.{_format}',
|
||||||
'operations' =>
|
'operations' =>
|
||||||
array(
|
array(
|
||||||
0 =>
|
|
||||||
array(
|
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',
|
||||||
@ -148,21 +149,20 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array(
|
||||||
0 => 'json',
|
'json',
|
||||||
1 => 'xml',
|
'xml',
|
||||||
2 => 'html',
|
'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]',
|
'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.',
|
||||||
@ -170,7 +170,6 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
),
|
),
|
||||||
'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test[tests]',
|
'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.',
|
||||||
@ -245,31 +244,35 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
'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',
|
||||||
),
|
),
|
||||||
|
1 =>
|
||||||
|
array(
|
||||||
|
'code' => 400,
|
||||||
|
'message' => 'See standard HTTP status code reason for 400',
|
||||||
|
'responseModel' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Form.SimpleType.ErrorResponse'
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
'type' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
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',
|
||||||
@ -277,31 +280,28 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array(
|
||||||
0 => 'json',
|
'json',
|
||||||
1 => 'xml',
|
'xml',
|
||||||
2 => 'html',
|
'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array (
|
array(),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array(
|
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',
|
||||||
@ -309,15 +309,14 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array(
|
||||||
0 => 'json',
|
'json',
|
||||||
1 => 'xml',
|
'xml',
|
||||||
2 => 'html',
|
'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -327,7 +326,7 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test' =>
|
||||||
array(
|
array(
|
||||||
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test',
|
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test',
|
||||||
'description' => NULL,
|
'description' => null,
|
||||||
'properties' =>
|
'properties' =>
|
||||||
array(
|
array(
|
||||||
'a' =>
|
'a' =>
|
||||||
@ -344,7 +343,7 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
),
|
),
|
||||||
'required' =>
|
'required' =>
|
||||||
array(
|
array(
|
||||||
0 => 'a',
|
'a',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test[tests]' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test[tests]' =>
|
||||||
@ -356,7 +355,7 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
'tests' =>
|
'tests' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'description' => NULL,
|
'description' => null,
|
||||||
'items' =>
|
'items' =>
|
||||||
array(
|
array(
|
||||||
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test',
|
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.Test',
|
||||||
@ -365,7 +364,7 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
),
|
),
|
||||||
'required' =>
|
'required' =>
|
||||||
array(
|
array(
|
||||||
0 => 'tests',
|
'tests',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest' =>
|
||||||
@ -415,8 +414,7 @@ class SwaggerFormatterTest extends WebTestCase
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'required' =>
|
'required' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' =>
|
||||||
array(
|
array(
|
||||||
@ -471,16 +469,84 @@ With multiple lines.',
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'required' =>
|
'required' =>
|
||||||
array (
|
array(),
|
||||||
),
|
),
|
||||||
|
'FieldErrors' =>
|
||||||
|
array(
|
||||||
|
'id' => 'FieldErrors',
|
||||||
|
'description' => 'Errors on the parameter',
|
||||||
|
'properties' => array(
|
||||||
|
'errors' => array(
|
||||||
|
'type' => 'array',
|
||||||
|
'description' => 'array of errors',
|
||||||
|
'items' => array(
|
||||||
|
'type' => 'string',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'required' => array()
|
||||||
|
),
|
||||||
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Form.SimpleType.FormErrors' =>
|
||||||
|
array(
|
||||||
|
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Form.SimpleType.FormErrors',
|
||||||
|
'description' => 'Errors',
|
||||||
|
'properties' => array(
|
||||||
|
'simple' => array(
|
||||||
|
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Form.SimpleType.FieldErrors[simple]',
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'required' => array()
|
||||||
|
),
|
||||||
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Form.SimpleType.ErrorResponse' => array(
|
||||||
|
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Form.SimpleType.ErrorResponse',
|
||||||
|
'description' => '',
|
||||||
|
'properties' => array(
|
||||||
|
'status_code' => array(
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => 'The status code',
|
||||||
|
'format' => 'int32',
|
||||||
|
),
|
||||||
|
'message' => array(
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => 'The error message',
|
||||||
|
),
|
||||||
|
'errors' => array(
|
||||||
|
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Form.SimpleType.FormErrors',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'required' => array(),
|
||||||
|
),
|
||||||
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Form.SimpleType.FieldErrors[simple]' =>
|
||||||
|
array(
|
||||||
|
'id' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Form.SimpleType.FieldErrors[simple]',
|
||||||
|
'description' => 'Errors on the parameter',
|
||||||
|
'properties' => array(
|
||||||
|
'a' => array(
|
||||||
|
'$ref' => 'FieldErrors',
|
||||||
|
),
|
||||||
|
'b' => array(
|
||||||
|
'$ref' => 'FieldErrors',
|
||||||
|
),
|
||||||
|
'c' => array(
|
||||||
|
'$ref' => 'FieldErrors',
|
||||||
|
),
|
||||||
|
'd' => array(
|
||||||
|
'$ref' => 'FieldErrors',
|
||||||
|
),
|
||||||
|
'e' => array(
|
||||||
|
'$ref' => 'FieldErrors',
|
||||||
|
),
|
||||||
|
'g' => array(
|
||||||
|
'$ref' => 'FieldErrors',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'required' => array(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'produces' =>
|
'produces' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
'consumes' =>
|
'consumes' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
'authorizations' =>
|
'authorizations' =>
|
||||||
array(
|
array(
|
||||||
'apiKey' =>
|
'apiKey' =>
|
||||||
@ -501,19 +567,19 @@ With multiple lines.',
|
|||||||
'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',
|
||||||
'parameters' =>
|
'parameters' =>
|
||||||
array(
|
array(
|
||||||
0 =>
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => '_format',
|
'name' => '_format',
|
||||||
@ -521,15 +587,15 @@ With multiple lines.',
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array(
|
||||||
0 => 'json',
|
'json',
|
||||||
1 => 'xml',
|
'xml',
|
||||||
2 => 'html',
|
'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array(
|
array(
|
||||||
0 =>
|
|
||||||
array(
|
array(
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'See standard HTTP status code reason for 200',
|
'message' => 'See standard HTTP status code reason for 200',
|
||||||
@ -540,26 +606,24 @@ With multiple lines.',
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
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',
|
||||||
@ -567,31 +631,28 @@ With multiple lines.',
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array(
|
||||||
0 => 'json',
|
'json',
|
||||||
1 => 'xml',
|
'xml',
|
||||||
2 => 'html',
|
'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array (
|
array(),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array(
|
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',
|
||||||
@ -599,15 +660,14 @@ With multiple lines.',
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'enum' =>
|
'enum' =>
|
||||||
array(
|
array(
|
||||||
0 => 'json',
|
'json',
|
||||||
1 => 'xml',
|
'xml',
|
||||||
2 => 'html',
|
'html',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -617,7 +677,7 @@ 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' => NULL,
|
'description' => null,
|
||||||
'properties' =>
|
'properties' =>
|
||||||
array(
|
array(
|
||||||
'foo' =>
|
'foo' =>
|
||||||
@ -661,8 +721,7 @@ With multiple lines.',
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'required' =>
|
'required' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsNested' =>
|
||||||
array(
|
array(
|
||||||
@ -717,8 +776,7 @@ With multiple lines.',
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'required' =>
|
'required' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest[]' =>
|
'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest[]' =>
|
||||||
array(
|
array(
|
||||||
@ -729,7 +787,7 @@ With multiple lines.',
|
|||||||
'' =>
|
'' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'description' => NULL,
|
'description' => null,
|
||||||
'items' =>
|
'items' =>
|
||||||
array(
|
array(
|
||||||
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
'$ref' => 'Nelmio.ApiDocBundle.Tests.Fixtures.Model.JmsTest',
|
||||||
@ -738,16 +796,14 @@ With multiple lines.',
|
|||||||
),
|
),
|
||||||
'required' =>
|
'required' =>
|
||||||
array(
|
array(
|
||||||
0 => '',
|
'',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'produces' =>
|
'produces' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
'consumes' =>
|
'consumes' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
'authorizations' =>
|
'authorizations' =>
|
||||||
array(
|
array(
|
||||||
'apiKey' =>
|
'apiKey' =>
|
||||||
@ -801,10 +857,8 @@ With multiple lines.',
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array (
|
array(),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'summary' => 'index action',
|
'summary' => 'index action',
|
||||||
@ -818,14 +872,12 @@ With multiple lines.',
|
|||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'query',
|
'paramType' => 'query',
|
||||||
'name' => 'a',
|
'name' => 'a',
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
'description' => null,
|
'description' => null,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'query',
|
'paramType' => 'query',
|
||||||
'name' => 'b',
|
'name' => 'b',
|
||||||
@ -834,10 +886,8 @@ With multiple lines.',
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array (
|
array(),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'summary' => 'create test',
|
'summary' => 'create test',
|
||||||
@ -851,27 +901,23 @@ With multiple lines.',
|
|||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'a',
|
'name' => 'a',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => 'A nice description',
|
'description' => 'A nice description',
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'b',
|
'name' => 'b',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'c',
|
'name' => 'c',
|
||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
'defaultValue' => false,
|
'defaultValue' => false,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'd',
|
'name' => 'd',
|
||||||
@ -880,44 +926,37 @@ With multiple lines.',
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array (
|
array(),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'summary' => 'create test',
|
'summary' => 'create test',
|
||||||
'nickname' => 'post_tests',
|
'nickname' => 'post_tests',
|
||||||
'parameters' =>
|
'parameters' =>
|
||||||
array(
|
array(
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'path',
|
'paramType' => 'path',
|
||||||
'name' => '_format',
|
'name' => '_format',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'a',
|
'name' => 'a',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => 'A nice description',
|
'description' => 'A nice description',
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'b',
|
'name' => 'b',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'c',
|
'name' => 'c',
|
||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
'defaultValue' => false,
|
'defaultValue' => false,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'paramType' => 'form',
|
'paramType' => 'form',
|
||||||
'name' => 'd',
|
'name' => 'd',
|
||||||
@ -926,21 +965,17 @@ With multiple lines.',
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'responseMessages' =>
|
'responseMessages' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'models' =>
|
'models' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
'produces' =>
|
'produces' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
'consumes' =>
|
'consumes' =>
|
||||||
array (
|
array(),
|
||||||
),
|
|
||||||
'authorizations' =>
|
'authorizations' =>
|
||||||
array(
|
array(
|
||||||
'apiKey' => array(
|
'apiKey' => array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user