Make the `field_config_base` structure fully validatable

Created on 15 August 2025, about 2 months ago

Problem/Motivation

It would be really helpful to recipes if we could make fields and field storages fully validatable. This is a big lift; in many ways, it's the boss battle of config schema validation. So I think we should take it on in smaller, bite-sized chunks. Let's start with a base schema type that is used as the foundation of other config schema definitions: field_config_base.

Proposed resolution

Add constraints to as many properties of field_config_base as possible, and mark it fully validatable.

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component

configuration system

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

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

Merge Requests

Comments & Activities

  • Issue created by @phenaproxima
  • Merge request !13004Add constraints and see what breaks β†’ (Open) created by phenaproxima
  • Pipeline finished with Failed
    about 2 months ago
    Total: 523s
    #573821
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Not sure where you got StringParts from here?

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Came from XB. Should be in core.

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

    Unfortunately a little optimistic:

    πŸ“Œ Convert field_storage_config and field_config's form validation logic to validation constraints Needs work found it here. Not yet part of core.

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

    So guess this is kinda a child of that :x

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

    Added the missing contraint and a basic first test.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 205s
    #579284
  • Pipeline finished with Failed
    about 1 month ago
    Total: 179s
    #579295
  • Pipeline finished with Failed
    about 1 month ago
    #579367
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Added latest code from XB, unfortunately for now we are failing on PluginExists suddenly. Not sure why yet.

  • Pipeline finished with Failed
    about 1 month ago
    #579427
  • Pipeline finished with Failed
    about 1 month ago
    #585155
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Asjusted the expected interface for the entity type. Entitytypemanager returns the Entity class, not the type class. So changed the interface we check for.

    Also was missing a required option in the config_test.

  • Pipeline finished with Failed
    about 1 month ago
    #585166
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Only 2 failing tests it seems, because of missing adjustments in the tests using config_test. I added a new key, and that resulted in some changes in the TypedConfigTest

  • Pipeline finished with Running
    about 1 month ago
    #585206
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Only unrealated failure on the database left! Yay!

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

    I have one question on the MR.

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

    You are right. If we want to check for fieldable, we should actually check for that interface. Adjusted. Setting to NR (although tests are running still).

  • Pipeline finished with Success
    about 1 month ago
    Total: 480s
    #587070
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    🀩

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

    Oh: the one thing I could complain about is that neither FieldConfig nor BaseFieldOverride (both of these config entity types are made fully validatable as of this issue) have their test coverage updated (FieldConfigValidationTest) to verify a sensible error is thrown.

    StringPartsConstraintValidatorTest exists, but doesn't actually test the generated validation error.

    IMHO both config entity types should get a trivial bit of test coverage similar to \Drupal\Tests\experience_builder\Kernel\Config\ComponentValidationTest::testInvalidId().

  • Pipeline finished with Canceled
    about 1 month ago
    #587144
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 70s
    #587147
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Thanks for the review :) I'll have a go to update test.

    Also see if i can create some followups for

    • EntityViewMode
    • EntityFormMode
    • EntityViewDisplay
    • EntityFormDisplay
  • Pipeline finished with Success
    about 1 month ago
    #587148
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 420s
    #587313
  • Pipeline finished with Failed
    about 1 month ago
    Total: 780s
    #587317
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Tried a few things to get FieldConfigValidationTest to work, didnt get it to do what i like. Cannot mutate id field, and not getting later errors there. Even tried to remove the Immutable property, but didnt get it there.

    I added a test for the message in the testStringPartsConstraint so i covered it from that side i guess?

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

    To me, it seems like this is sufficient test coverage

  • The Needs Review Queue Bot β†’ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

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

    Rebased

  • Pipeline finished with Failed
    26 days ago
    Total: 725s
    #591849
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands
  • Pipeline finished with Success
    25 days ago
    Total: 709s
    #592061
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands
  • Pipeline finished with Canceled
    14 days ago
    Total: 80s
    #602183
  • Pipeline finished with Canceled
    14 days ago
    Total: 75s
    #602184
  • Pipeline finished with Success
    14 days ago
    #602186
  • Pipeline finished with Success
    2 days ago
    Total: 1857s
    #613545
Production build 0.71.5 2024