Problem/Motivation
Views taxonomy term filter config schema should contain a sequence of integers, not strings. The schema doesn't match our expectations.
See #2372855-58: Add content & config entity dependencies to views and #2372855-60: Add content & config entity dependencies to views.
Along the way of fixing this bug, we found it is not possible to cleanly implement due to how merging base types is behaving unexpectedly for sequence types and would be impossible while merging/overriding other type information is entirely possible.
Proposed resolution
Adjust the schema and occurrences. Fix the type merging in configuration schema so sequences can be overridden in subtypes like the rest of the types.
Remaining tasks
Review.
User interface changes
None.
API changes
None.
Beta phase evaluation
| Issue priority | Major because sequences cannot be subtyped with item type changes in config schema. This is a systemic problem and does not match expectations that other types have. |
|---|---|
| Prioritized changes | Prioritized for the beta phase because it changes configuration schemas for views filters and fixes a bug in how configuration schemas work (and may be written). |
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 2392263-taxonomy-views-filter-schema-12.patch | 3.71 KB | gábor hojtsy |
| #12 | interdiff.txt | 1.88 KB | gábor hojtsy |
| #9 | 2392263-taxonomy-views-filter-schema.patch | 1.83 KB | gábor hojtsy |
Comments
Comment #1
gábor hojtsyDoes that have a failing test? If yeah it may be easier to fix it there. It may be more painful to provide a standalone test here.
Comment #2
wim leersYes, it caused a failed test, that's how it was discovered
Comment #3
gábor hojtsyRight, it may be simpler to fix it there? No need for one more explicit test then?
Comment #4
wim leersIf you want to reroll the patch there to include that change, that's fine by me :)
Comment #5
gábor hojtsySo we can postpone on #2372855: Add content & config entity dependencies to views and just update that config.
Comment #6
effulgentsia commented#2372855: Add content & config entity dependencies to views is fixed, so unpostponing this one.
Comment #7
xjmComment #8
xjmThis also could probably be a novice issue!
Comment #9
gábor hojtsyWhere the schema is incorrect, it will be a D8 upgrade path issue because we would need to write an update function for updating the config structure to the new correct expectation. At that point I am not sure this would be a novice.
Additionally to the incorrect value type on views.filter.taxonomy_index_tid (inherited from views.filter.many_to_one), the definition of views.filter.taxonomy_index_tid_depth was entirely incorrect. It inherits from views.filter.taxonomy_index_tid on the PHP side (class TaxonomyIndexTidDepth extends TaxonomyIndexTid) so should on the schema side. Then all the duplicate keys should be removed (including values). The only new field is depth. See TaxonomyIndexTidDepth::defineOptions().
Comment #10
dawehnerLooks fine for me.
Comment #12
gábor hojtsySo this is a WAY bigger mess than expected. The problem is as follows:
1. views_filter defines a value key as a dynamic type based on the filter's plugin_id:
So all types extending from views_filter theoretically need to define their own value via subtyping in the
views.filter_value.Xnamespace. Here are some:That is all good, and these are actually single value filter types. BUT then there are multivalue field types, chiefly InOperator and its extension ManyToOne. The config schema for those defined the value as a sequence of strings.
Due to how this is deepmerged, the sequence typing overrides the original dynamic type so all in_operator inheritors (such as many to one, taxonomy index tid, etc) take the string sequence instead of the dynamic type.
Now we naturally want to override that in
views.filter.taxonomy_index_tidwhich turns out to be impossible. Why? If you look into TypedConfigManager::getDefinition(), the definition is merged in with the parent, giving the child precedent but NestedArray::mergeDeep() is used, which accumulates numerically indexed array items instead of replacing them with each other. Configuration schema uses numerically indexed items for typing only for sequences. It is a bit of an odd use of a list because it can only ever have one item, but well, that is how it is now. We could change that and incur the API change across all schemas or we need to fix the merging to not accumulate array items (having second and third type definitions for the sequence) but to overwrite it, so our type definition for the taxonomy item will prevail.Definitely not novice and at least a major.
Additionally to the PHP bugfix, removing the elements from many_to_one that are already inherited and removing a never ever used views.filter_value.language since the parent filter definition is an in_operator, so as discussed above, the dynamic views.filter_value.language value would never be consulted anyway. (Its also incorrect, the in_operator is multivalued not single valued).
Updated issue summary and added beta evaluation as well.
Comment #13
vijaycs85Looks good.
another cleanup?
left over removal++
Comment #14
alexpottCommitted a542a43 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation.