-
-
Notifications
You must be signed in to change notification settings - Fork 108
Closed
Description
On the last api-platform distribution.
Actual Result
When I generate entity with an attribute that is not in schema.org, @Assert\NotNull
annotation is always added.
Expected Result
@Assert\NotNull
should be added only when I write nullable: false
.
Example
/api-platform/api/config/schema.yml
types:
Thing:
parent: false
properties:
name: ~
customName: {range: Text}
otherCustomName: {range: Text, nullable: true, ormColumn: 'type="text", nullable=true'}
/api-platform/api/src/Entity/Thing.php
class Thing
{
[...]
/**
* @var string|null the name of the item
*
* @ORM\Column(type="text", nullable=true)
* @ApiProperty(iri="http://schema.org/name")
*/
private $name;
/**
* @var string
*
* @ORM\Column(type="text")
* @Assert\NotNull
*/
private $customName;
/**
* @var string
*
* @ORM\Column(type="text", nullable=true)
* @Assert\NotNull
*/
private $otherCustomName;
[...]
For a standard attribute, the @Assert\NotNull
annotation is not added.
but that's the case for all other custom entities.
lologhi, PhilemonBouzy and yohann-teisseire
Metadata
Metadata
Assignees
Labels
No labels