Ignore Type::$nullable (#1391)

This commit is contained in:
Guilhem N 2018-08-30 01:10:36 +02:00 committed by GitHub
parent 0e72b64e3c
commit 99833189fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -110,6 +110,8 @@ class ObjectModelDescriber implements ModelDescriberInterface, ModelRegistryAwar
$property->setType('string');
$property->setFormat('date-time');
} else {
$type = new Type($type->getBuiltinType(), false, $type->getClassName(), $type->isCollection(), $type->getCollectionKeyType(), $type->getCollectionValueType()); // ignore nullable field
$property->setRef(
$this->modelRegistry->register(new Model($type, $model->getGroups()))
);

View File

@ -66,6 +66,11 @@ class User
*/
private $users;
/**
* @var User|null
*/
private $friend;
/**
* @var string
*
@ -118,6 +123,10 @@ class User
{
}
public function setFriend(self $friend = null)
{
}
public function setDummy(Dummy $dummy)
{
}

View File

@ -41,6 +41,8 @@ class FunctionalTest extends WebTestCase
$modelProperties = $this->getModel('Article')->getProperties();
$this->assertCount(1, $modelProperties);
$this->assertTrue($modelProperties->has('author'));
$this->assertSame('#/definitions/User2', $modelProperties->get('author')->getRef());
$this->assertFalse($modelProperties->has('content'));
}
@ -209,6 +211,9 @@ class FunctionalTest extends WebTestCase
],
'type' => 'array',
],
'friend' => [
'$ref' => '#/definitions/User',
],
'dummy' => [
'$ref' => '#/definitions/Dummy2',
],