- 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
- π³π±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.
- Merge request !11675Draft: Resolve #3512962 "Field.storage indexes validation array" β (Closed) created by bbrala
- π³π±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.