Skip to content
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

[12.x] Validate UUID's version optionally #53341

Merged
merged 10 commits into from
Oct 31, 2024

Conversation

shaedrich
Copy link

@shaedrich shaedrich commented Oct 29, 2024

Revive #21672 by @vanodevium

That allows to do something like this:

class MyRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'user_uuid' => [ 'required', 'uuid' ], // default, unchanged
            'order_uuid' => [ 'uuid:4' ],
            'request_uuid' => [ 'uuid:1' ],
        ];
    }
}

@taylorotwell
Copy link
Member

Can you add a test and mark as ready for review?

@taylorotwell taylorotwell marked this pull request as draft October 30, 2024 14:06
Suggested-by: Vano Devium <[email protected]>
cc: Vano Devium <[email protected]>
thanks-to: Vano Devium <[email protected]>
original-patch-by: Vano Devium <[email protected]>
based-on-a-patch-by: Vano Devium <[email protected]>
based-on-patch-by: Vano Devium <[email protected]>
credit-to: Vano Devium <[email protected]>
inspired-by-patch-by: Vano Devium <[email protected]>
initial-work-by: Vano Devium <[email protected]>
inspired-by: laravel#21672
Suggested-by: Vano Devium <[email protected]>
cc: Vano Devium <[email protected]>
thanks-to: Vano Devium <[email protected]>
original-patch-by: Vano Devium <[email protected]>
based-on-a-patch-by: Vano Devium <[email protected]>
based-on-patch-by: Vano Devium <[email protected]>
credit-to: Vano Devium <[email protected]>
inspired-by-patch-by: Vano Devium <[email protected]>
initial-work-by: Vano Devium <[email protected]>
inspired-by: laravel#21672
@shaedrich shaedrich marked this pull request as ready for review October 30, 2024 23:05
@shaedrich
Copy link
Author

Tests are added as asked

@taylorotwell taylorotwell merged commit 0dfeef5 into laravel:master Oct 31, 2024
31 checks passed
@shaedrich shaedrich deleted the validate-uuid-version branch October 31, 2024 17:45
shaedrich added a commit to shaedrich/framework that referenced this pull request Oct 31, 2024
– Remove unused imports
– Spacing

improves: laravel#53341
taylorotwell added a commit that referenced this pull request Nov 1, 2024
* feat: ✨ Add support for UUID v2 and max UUID validation

* test: ✅ Add cases for every supported UUID version to data provider of UUID validation tests

* style: 🎨 Fix StyleCI errors

– Remove unused imports
– Spacing

improves: #53341

* Add missing import

* style: 🎨 Remove indent from blank line

* Add ramsey/uuid to composer suggestions

to be able to use it for UUID version constraint validation

* Update Str.php

* Update Str.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants