Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Add the config schema for the views plugin in datetime.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#26 | 2895544-26.patch | 4.03 KB | mpdonadio |
#18 | 2895544-18.patch | 4.05 KB | Lendude |
#18 | 2895544-18-TEST_ONLY.patch | 2.57 KB | Lendude |
Comments
Comment #2
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedAdding schema for the views plugin in datetime module, not sure if it is correctly defined with the config inheritance.
Comment #3
mpdonadioLittle confused why this wasn't caught when the strict config checking got enabled.
Comment #4
mpdonadioComment #5
Berdir> Little confused why this wasn't caught when the strict config checking got enabled.
Me too.
We noticed this in a custom install profile, where we run config schema validation on all our default configuration.
I think this kind of works because views has wildcard schema definitions for most of its things, for example this:
So it works as long as you don't add special settings keys.
In our case it failed because of the missing schema for the granularity setting in the sort plugin.
The test fails are because the type definition is wrong in the current patch, we're working on that.
Comment #6
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedFixing schema
Comment #7
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedAdding granularity setting as a test.
Comment #8
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedFixed date filter in the views schema and added it properly in the datetime module.
Comment #10
dawehnerI am not 100% convinced of these changes:
\Drupal\datetime\Plugin\views\argument\YearDate
extends\Drupal\datetime\Plugin\views\Argument\Date
and not\Drupal\views\Plugin\views\argument\YearDate
Comment #11
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedChanged the type of the views arguments.
Comment #13
jhedstromAssigning to @dawehner for final review. I think these look good at this point.
Comment #14
LendudeThis is fairly minimal test coverage, somebody could remove this and everything would still be green and we'd have no indication that we lost coverage.
Would probably be a good idea to have a test that verifies that this granularity is set, that way we'd have a failing test if somebody removed the setting from the view.
Also it only 'tests' the sort schema, not sure what type of coverage is expected for the other schema.
Comment #15
jhedstromI agree with @Lendude's assessment of the fragility of this test, so marking NW to work for #14.
Comment #16
jhedstromJust marked #2721339: Missing schema for field_date_value as a duplicate. There was the start of some more explicit tests there.
Comment #17
mpdonadioI started a test, but I can't get one to fail..
Comment #18
LendudeThis does the trick for me.
Comment #20
jhedstromI think this is good to go.
Comment #21
jhedstromComment #22
xjmPromoting to major since this soft-blocks a major: #2786577: The Views integration Datetime Range fields should extend the views integration for regular Datetime fields
Comment #23
larowlanAdding review credits
Comment #24
larowlanFixed on commit
Committed 93045af and pushed to 8.5.x.
Leaving at RTBC and moving to 8.4 for possible backport.
Comment #26
mpdonadio$ git pull
$ git checkout 8.4.x
$ git cherry-pick 93045af
$ git diff origin/8.4.x > 2895544-26.patch
Just uploading this so we have runs against 8.4.x
This is currently a major bug with a clean cherry-pick, so I think this should be good against 8.4.x. I can't think of a potential disruption?
Comment #27
xjmSo if someone somehow had a view that had these saved in a different format than what the schema requires, or a child instance that didn't comply with the new schemata, what would happen?
Comment #29
xjmAdding credit for @kgoel who worked on the duplicate. (It's helpful when closing duplicates to add a list of contributors from the duplicate to the summary so committers can credit them too.) Thanks!
Comment #30
xjmWhat is the case for backporting it? That it's needed for the other major bugfixes like #2786577: The Views integration Datetime Range fields should extend the views integration for regular Datetime fields?
Comment #31
Gábor HojtsyI *think* it would be casted on the next save / import, but if directly validated, it will not be valid anymore. Would be good to verify though.
Comment #32
xjmLet's manually test for #31 before we backport this, to see what happens and evaluate the risk. Depending on what happens we might also consider an upgrade path?
Also probably should have a CR, and ideally the CR would include information on the impact for existing data as well.
Thanks!
Comment #33
andrewbelcher CreditAttribution: andrewbelcher at FreelyGive commentedCase for backporting is that is causes contrib/end product config schema tests to fail, e.g. granularity on a datetime sort. Sticking with failing tests, removing test coverage or having to patch core until 8.5.0 is not a good alternative.
Comment #34
jhedstromI'm fine with backporting if somebody can verify #31 manually as @xjm requested in #32.
Comment #35
BerdirOnly critical fixes will be backported to 8.4.x anymore, so closing this and setting back to 8.5.x.
I could not find any existing change records for similar changes in the past, IMHO this doesn't need one. We didn't *change* the schema, we added missing schema. Anyone we already validates his schema would have had fails before no matter what type they were.
Feel free to re-open if you disagree but nothing happened in 2 month here so I doubt it will if we re-open.