Add support for Sequentially constraint

Created on 25 April 2025, 5 months ago

Problem/Motivation

Let's start with a very usefull contraint: Sequentially. Which allows us to layer contraints. Which could help in only reporting errors which are usefull instead of walking through all the contraints.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component

other

Created by

πŸ‡³πŸ‡±Netherlands bbrala Netherlands

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

Merge Requests

Comments & Activities

  • Issue created by @bbrala
  • Pipeline finished with Canceled
    5 months ago
    Total: 92s
    #481811
  • Pipeline finished with Failed
    5 months ago
    Total: 231s
    #481812
  • Pipeline finished with Failed
    5 months ago
    Total: 142s
    #481815
  • Pipeline finished with Failed
    5 months ago
    Total: 6818s
    #481833
  • Pipeline finished with Canceled
    5 months ago
    Total: 16166s
    #482098
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Wow, am i dreaming. This little trick might make it possible to support those symfony constraints without weirdness.

    Everything is green... It cant be that easy right?

  • Pipeline finished with Canceled
    5 months ago
    Total: 420s
    #482267
  • Pipeline finished with Success
    5 months ago
    Total: 448s
    #482277
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Left some small comments and a question

    If you are another contributor eager to jump in, please allow the previous poster(s) at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Fixed issues, but kinda need someone into validation to review this since it feels weird this works at face value. It might overlook issues.

  • Pipeline finished with Success
    5 months ago
    Total: 4164s
    #483562
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Removing tag since committer who will review this seems to be the subsystem maintainer.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Going to mark because I believe all feedback has been addressed on this one, thank you for adding the CR.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    I did not do a code review but I left a question about the name of the constraint and then made some minor suggestions.

    This should have another opinion about the name, not just mine.

  • Pipeline finished with Canceled
    14 days ago
    #585575
  • Pipeline finished with Canceled
    14 days ago
    #585578
  • Pipeline finished with Canceled
    14 days ago
    #585579
  • Status changed to RTBC 14 days ago
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Thanks quietone for the review. Since it was all style/wording ill set it back to RTBC

  • Pipeline finished with Failed
    14 days ago
    #585580
  • πŸ‡§πŸ‡ͺBelgium borisson_ Mechelen, πŸ‡§πŸ‡ͺ

    While this is great, we don't usually add new features if they don't have an immediate usecase in core. Do you know where we could be using this? Or is this just about exposing all the symfony constraints?

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Valid point. As per parent Wim said he had a quite a few places where this was usefull, but he didnt say where. When i look at core i see a few places where this might be quite usefull. Few examples:

    # file: block.schema.yml
        theme:
          type: string
          label: 'Theme'
          constraints:
            NotBlank: []
            ExtensionName: []
            ExtensionExists: theme
    

    Here it could first say "Should not be blank", then if that is true "Invalid extension name", when "Extension does not exist".

    This is way better than doing them all.

    Same here:

    # file: block.schema.yml
        region:
          type: string
          label: 'Region'
          constraints:
            NotBlank: []
            Callback: ['\Drupal\block\Entity\Block', validateRegion]
    

    or

    # Plugin \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Language
    ckeditor5.plugin.ckeditor5_language:
      type: mapping
      label: 'Language'
      constraints:
        FullyValidatable: ~
      mapping:
        language_list:
          type: string
          label: 'Language list ID'
          constraints:
            # Configuring this does not make sense without the corresponding button.
            CKEditor5ToolbarItemDependencyConstraint:
              toolbarItem: textPartLanguage
            # Only the following values are accepted.
            Choice:
              # United Nations "official languages".
              - un
              # Drupal's predefined language list.
              - all
              # Languages configured at /admin/config/regional/language for the site.
              - site_configured
    

    I think a lot of the places where more than one constraint is defined we should use this. Should we pick one or perhaps just do follow ups? What do you think.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    #12++

  • πŸ‡§πŸ‡ͺBelgium borisson_ Mechelen, πŸ‡§πŸ‡ͺ

    I think a lot of the places where more than one constraint is defined we should use this. Should we pick one or perhaps just do follow ups? What do you think.

    I think doing followups makes most sense here.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    I've made 🌱 [META] Update schema's with multiple contraints to SequentiallyConstraint Active to start working on those after this issue.

Production build 0.71.5 2024