mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-08 18:49:26 +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,
|
||||
'required' => null,
|
||||
'description' => null,
|
||||
'readonly' => null
|
||||
'readonly' => null,
|
||||
'default' => is_scalar($item) ? $item : null,
|
||||
);
|
||||
|
||||
if ($type == 'object' && $item instanceof \JsonSerializable) {
|
||||
|
@ -52,13 +52,15 @@ class JsonSerializableParserTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
'property' => 'id',
|
||||
'expected' => array(
|
||||
'dataType' => 'integer'
|
||||
'dataType' => 'integer',
|
||||
'default' => 123
|
||||
)
|
||||
),
|
||||
array(
|
||||
'property' => 'name',
|
||||
'expected' => array(
|
||||
'dataType' => 'string'
|
||||
'dataType' => 'string',
|
||||
'default' => 'My name',
|
||||
)
|
||||
),
|
||||
array(
|
||||
@ -72,7 +74,8 @@ class JsonSerializableParserTest extends \PHPUnit_Framework_TestCase
|
||||
'subType' => null,
|
||||
'required' => null,
|
||||
'description' => null,
|
||||
'readonly' => null
|
||||
'readonly' => null,
|
||||
'default' => null,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user