field.storage.*.*: indexes validation uses "ignore" type therefor is not validated really.

Created on 14 March 2025, 19 days ago

Problem/Motivation

Split of the parent issue:

field.storage.*.*:
  mapping:
...
    indexes:
      type: sequence
      label: 'Indexes'
      # @todo Constraints β€” but shockingly this A) uses `type: ignore`, B) has zero validation logic in core?!
      sequence:
        type: sequence
        label: 'Indexes'
        sequence:
          type: ignore
          label: 'Index'

This seems wrong, we need to see if we can get this to actually validate.

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

configuration system

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
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Fun fact is that indexes have a default, like value => [value], but that the shape can be defined in the childs, therefor this is really hard to reallt validate.

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

    From FieldItemInterface:

       *   - indexes: (optional) An array of Schema API index definitions. Only
       *     columns that appear in the 'columns' array are allowed. Those indexes
       *     will be used as default indexes. Field definitions can specify
       *     additional indexes or, at their own risk, modify the default indexes
       *     specified by the field-type module. Some storage engines might not
       *     support indexes.
    

    I think this is overkill really to validate. I would vote to skip trying to validate this.

    There are posiiblities to at least check if the schema is part of the columns. But don't really seem much value in that.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Compromise if we keep the ignore can we add a comment why

  • Merge request !11673Draft: chore: comment on the Ingore β†’ (Open) created by bbrala
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Hmm, was thinking while writing the comment. It could be validated to be an array. It is optional, but seems to always be an array. The array shape is extrmely flexibly. But an array nevertheless.

  • Pipeline finished with Success
    4 days ago
    Total: 649s
    #460241
  • Pipeline finished with Failed
    4 days ago
    Total: 610s
    #460248
  • Pipeline finished with Failed
    4 days ago
    Total: 478s
    #460259
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    tried a few different ways to get this to work. I couldn't, its way to diverse imo.

    Added the comment.

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

    Can we do this the same way we define plugins? Each one having their own schema?

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

    Not too sure man. Although anything is possible right now looking at contrib (core doesnt really do much here) i see stuff like:

    'indexes' => array(
          'target_id' => array(
            0 => 'target_id',
          ),
        ),
    
          $fields[$field_name]->setIndexes(['value' => ['value']]);
    
    $field_storage->setIndexes([
        'value' => ['value']
      ]);
    

    (url : https://git.drupalcode.org/search?group_id=2&scope=blobs&search=-path%3A...)

    And not much more.

    I feel like i'm boucing between, it should be possible, and its not worth it every time i read about this. So perhaps i should defer to those who are into this a bit more.

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

    I too am constantly bouncing between the need to validate everything strictly and the looseness that is allowed currently.

Production build 0.71.5 2024