-
-
Notifications
You must be signed in to change notification settings - Fork 958
Open
Description
API Platform version(s) affected: 4.2
Again, not fully sure about it @soyuka since the whole schema things is new to me...
Description
Looking at ValidationException::getConstraintViolationList
core/src/Validator/Exception/ValidationException.php
Lines 193 to 211 in 14b754a
| #[SerializedName('violations')] | |
| #[Groups(['json', 'jsonld'])] | |
| #[ApiProperty( | |
| jsonldContext: ['@type' => 'ConstraintViolationList'], | |
| schema: [ | |
| 'type' => 'array', | |
| 'items' => [ | |
| 'type' => 'object', | |
| 'properties' => [ | |
| 'propertyPath' => ['type' => 'string', 'description' => 'The property path of the violation'], | |
| 'message' => ['type' => 'string', 'description' => 'The message associated with the violation'], | |
| ], | |
| ], | |
| ] | |
| )] | |
| public function getConstraintViolationList(): ConstraintViolationListInterface | |
| { | |
| return $this->constraintViolationList; | |
| } |
the violations is described as an array of
'propertyPath' => ['type' => 'string', 'description' => 'The property path of the violation'],
'message' => ['type' => 'string', 'description' => 'The message associated with the violation'],
but, when dumping value on my side and according to the AbstractConstraintViolationListNormalizer I see more fields.
- code () which is string|null
'code' => $violation->getCode(), - hint () which is a string optional I guess ?
$violationData['hint'] = $hint; - payload () which is an array of mixed I guess ?
$violationData['payload'] = $payloadFields;
Possible Solution
If I am right, something like
'propertyPath' => ['type' => 'string', 'description' => 'The property path of the violation'],
'message' => ['type' => 'string', 'description' => 'The message associated with the violation'],
'code' => ['type' => 'string', 'description' => 'The code of the violation'],
'hint' => ['type' => 'string', 'description' => '...'],
'payload' => ['type' => 'array', 'description' => '...'],
but I'm not fully sure how code/hint/payload are optional
Metadata
Metadata
Assignees
Labels
No labels