-
-
Notifications
You must be signed in to change notification settings - Fork 958
feat(validator): uuid/ulid parameter validation #7649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(validator): uuid/ulid parameter validation #7649
Conversation
|
I'll fix the CI on the main branch asap. |
1711403 to
b342dd5
Compare
|
I think the PR requires changes because the uuid constraint is not add when the UuidFilter is used because the following schema is not supported Filtering by an invalid uuid should return a 422 response and not a 400 response |
|
sure let me know when I should review |
b342dd5 to
13addbd
Compare
13addbd to
5469d7f
Compare
|
@soyuka ready for review Filter by invalid uuidFilter by many invalid uuid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds UUID and ULID validation support to API Platform's parameter validation system. When query or header parameters specify format: uuid or format: ulid in their OpenAPI schema, Symfony's Uuid and Ulid validation constraints are automatically applied.
Changes:
- Added UUID/ULID validation constraints for string parameters with uuid/ulid format specifications
- Updated test assertions to expect HTTP 422 (Unprocessable Entity) instead of 400 (Bad Request) for invalid UUID inputs
- Added test coverage for both single and array UUID/ULID parameter validation in query and header contexts
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Validator/Util/ParameterValidationConstraints.php | Implements validation logic for uuid/ulid formats in both single values and oneOf array scenarios |
| tests/Functional/Uuid/UuidFilterBaseTestCase.php | Updates expected status codes from 400 to 422 for invalid UUID validation failures |
| tests/Functional/Parameters/ParameterTest.php | Adds test cases for valid and invalid UUID/ULID values in both query and header parameters |
| tests/Fixtures/TestBundle/ApiResource/WithParameter.php | Adds API resource configurations for testing UUID/ULID parameters in queries and headers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Adds Symfony validation constraints (Uuid or Ulid) to query parameters whose OpenAPI schema specifies format: uuid or format: ulid