mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Introduced default-value parameter to JsonSerializableParser
JSP is now able to set a default value for scalar types This makes merging the parser result with other parser results easier and gives some additional info when creating docs Removed PHP doc comment block
This commit is contained in:
parent
be90e8aad6
commit
aa10f9a2da
@ -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) {
|
||||||
|
@ -46,13 +46,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(
|
||||||
@ -66,7 +68,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