DenormalizationViolationFactory crash when GroupSequence is used
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 64/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start with src/Validator/DenormalizationViolationFactory.php around collectConstraints() and the reported call at line 130; compare how src/Symfony/Validator/Metadata/Property/ValidatorPropertyMetadataFactory.php handles GroupSequence. Reproduce with the provided PATCH test and GroupSequence; done when validation returns the expected 400 response without the type error and the relevant tests pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
API Platform version(s) affected: 5.0.2
Description
I have a patch operation
new Patch(
denormalizationContext: ['groups' => ['update:slug-target']],
security: "is_granted('slug_target.update', object)",
validationContext: [
'groups' => new Assert\GroupSequence(['Requirements', ['SlugTarget', 'update:slug-target']]),
],
),
which was working fine on 4.3. As soon as I bump on 5.0 I get an error in one of my tests
An error occurred","detail":"ApiPlatform\\Validator\\DenormalizationViolationFactory::collectConstraints(): Argument #3 ($validationGroups) must be of type ?array, Symfony\\Component\\Validator\\Constraints\\GroupSequence given, called in \/app\/vendor\/api-platform\/validator\/DenormalizationViolationFactory.php on line 130
My test was
$client->request('PATCH', '/slug-targets/'.$uuid, [
'json' => ['quality' => null],
'headers' => ['Content-Type' => 'application/merge-patch+json'],
]);
static::assertResponseStatusCodeSame(400);
The purpose was to test the constraint
#[Assert\Choice(choices: [TranslationQuality::REVIEWED], message: 'slug_target.quality.choices', groups: ['update:slug-target'])]
applied on the quality field.
Possible Solution
It's clear that GroupSequence are not handled here @soyuka
https://github.com/api-platform/core/blob/6f77a4d70fea96bdc1c259749cecfdeb135e9704/src/Validator/DenormalizationViolationFactory.php#L129-L130
I'm not sure about the purpose of the DenormalizationViolationFactory class/method but maybe there is something to copy from the ValidatorPropertyMetadataFactory.
https://github.com/api-platform/core/blob/6f77a4d70fea96bdc1c259749cecfdeb135e9704/src/Symfony/Validator/Metadata/Property/ValidatorPropertyMetadataFactory.php#L155-L197
- Ngôn ngữ chính
- PHP
- Star
- 2.6k
- Fork
- 989
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 90
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của api-platform/core
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
api-platform/core#8690 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SkolemIriConverter isn't reset between requests in worker mode (missing kernel.reset tag)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
api-platform/core#8680 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
api-platform/core#8686 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
api-platform/core#8664 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Metadata] Incorrect api schema for path variableCó thể đã có người làm @bram123 đã nhận 3 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
api-platform/core#8646 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của api-platform/core
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Automattic/blocks-engine#2866 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
community-scripts/ProxmoxVE#17944 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
EasyCorp/EasyAdminBundle#7861 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Good first issue: add laravel-inertia stack budget preset (Laravel 11 + Inertia.js + PHP 8.3)Đang mởenhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
backend gamification P0
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
semanadeinformatica/website#461 ·