Remove the restriction from RecursiveContextualValidator that prevents using custom groups.

Created on 16 July 2024, 9 months ago

Problem/Motivation

While working in 📌 Add validation constraints to core.menu.schema.yml Needs work we found that the RecursiveContextualValidator prevents us from using custom groups. But we want to use AtLeastOneOf constraint there and it's validator requires every constraint to have a group.

Steps to reproduce

Proposed resolution

Remove the exception from RecursiveContextualValidator that prevents us from using custom groups.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component
Configuration 

Last updated about 5 hours ago

Created by

🇮🇳India kunal.sachdev

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @kunal.sachdev
  • Pipeline finished with Success
    9 months ago
    Total: 1469s
    #225324
  • Status changed to Needs review 9 months ago
  • Status changed to RTBC 9 months ago
  • 🇺🇸United States smustgrave

    Seems straight forward.

  • 🇨🇭Switzerland znerol

    Given the info from #2820364-77: Entity + Field + Property validation constraints are processed in the incorrect order , I'd be quite surprised if removing the LogicException would be sufficient to support composite validators.

  • Status changed to Needs work 8 months ago
  • 🇬🇧United Kingdom longwave UK

    If we're going to do this it would be good to have some test coverage to prove that it does work (or indeed, as #6 implies, doesn't work).

  • First commit to issue fork.
  • 🇳🇱Netherlands bbrala Netherlands

    Tests are indeed needed, this one would be nice though to have. Commenting to put on my list. Think tests will not be very complicated here.

  • Pipeline finished with Success
    8 days ago
    Total: 451s
    #467593
  • Pipeline finished with Failed
    7 days ago
    Total: 132s
    #468082
  • Pipeline finished with Failed
    7 days ago
    Total: 175s
    #468083
  • Pipeline finished with Failed
    7 days ago
    Total: 122s
    #468177
  • Pipeline finished with Failed
    7 days ago
    Total: 120s
    #468183
  • Pipeline finished with Success
    7 days ago
    Total: 447s
    #468186
  • 🇳🇱Netherlands bbrala Netherlands
  • 🇳🇱Netherlands bbrala Netherlands
  • Pipeline finished with Success
    7 days ago
    Total: 448s
    #468234
  • 🇳🇱Netherlands bbrala Netherlands

    I found a way to support the AtLeastOneOf constraint without any changes to groups. This enables some fun stuff, like:

                constraints:
                  AtLeastOneOf:
                    constraints:
                      - PluginExists:
                          manager: plugin.manager.menu.link
                          interface: 'Drupal\Core\Menu\MenuLinkInterface'
                      - IdenticalTo:
                          value: ''
    

    Which is awesome and will help in other validation issues to support vlaidation without the need to make a lot of incompatible changes to migrate to needs null etc.

    I think this is ready to get a proper review. :)

  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    I reviewed this, looks perfect to me.
    Test coverage is great.

    I wanted to create an issue for supporting all composite symfony constraints without having to reimplement them, but never got to it.

    The good thing is that we ever end up doing it, this should be easily replaceable with that.
    For consistency and DX, we should implement all of them. Maybe we need sibling issues for each of the Composites in Symfony\Component\Validator\Constraints?

    I'm setting this to RTBC meanwhile.

  • Pipeline finished with Success
    6 days ago
    #469162
  • 🇳🇱Netherlands bbrala Netherlands

    Not sure this is good, while writing tests for 🐛 PDF files being downloaded RTBC i noted using these tests ends in an error where it thinks the constraint name is an array key. This means in on of the two something is weird i think. Setting abck to NW until i can investigate.

  • 🇳🇱Netherlands bbrala Netherlands

    Conclusion, it seems all good. SOrry for the confusion.

  • 🇳🇱Netherlands bbrala Netherlands
  • 🇳🇱Netherlands bbrala Netherlands
Production build 0.71.5 2024