mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
Merge pull request #749 from fstr/ISSUE-747-JSP
Introduced default-value parameter to JsonSerializableParser
This commit is contained in:
commit
eafa2ade0b
@ -59,7 +59,8 @@ class JsonSerializableParser implements ParserInterface
|
|||||||
'subType' => null,
|
'subType' => null,
|
||||||
'required' => null,
|
'required' => null,
|
||||||
'description' => null,
|
'description' => null,
|
||||||
'readonly' => null
|
'readonly' => null,
|
||||||
|
'default' => is_scalar($item) ? $item : null,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($type == 'object' && $item instanceof \JsonSerializable) {
|
if ($type == 'object' && $item instanceof \JsonSerializable) {
|
||||||
|
@ -52,13 +52,15 @@ class JsonSerializableParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
'property' => 'id',
|
'property' => 'id',
|
||||||
'expected' => array(
|
'expected' => array(
|
||||||
'dataType' => 'integer'
|
'dataType' => 'integer',
|
||||||
|
'default' => 123
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'property' => 'name',
|
'property' => 'name',
|
||||||
'expected' => array(
|
'expected' => array(
|
||||||
'dataType' => 'string'
|
'dataType' => 'string',
|
||||||
|
'default' => 'My name',
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@ -72,7 +74,8 @@ class JsonSerializableParserTest extends \PHPUnit_Framework_TestCase
|
|||||||
'subType' => null,
|
'subType' => null,
|
||||||
'required' => null,
|
'required' => null,
|
||||||
'description' => null,
|
'description' => null,
|
||||||
'readonly' => null
|
'readonly' => null,
|
||||||
|
'default' => null,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user