Problem/Motivation
#2316909: Revisit all built-in test/default views configuration in core rebuilt all the exported views, but it also showed some problems of the views schema:
- views.field.boolean:not should be a boolean, not a string.
- views_query defines schema not for the base class:
QueryPluginBase, but actually for the sql implementation. Let's add an try for the sql query plugin,
so contrib ones, can define their schema. - views_query:query_comment should be a string, not a boolean
- views.field.field:delta_limit, delta_offset should both be integers, not strings, the delta_limit 'all' special value should be represented as 0 (zero)
- views_display:defaults:* should all be boolean, some of strings
- views_field:alter:max_length is missing, should be an integer
Proposed resolution
Fix them, see problem/motivation
Remaining tasks
Commit.
User interface changes
None.
API changes
Views schemas are fixed as per the above.
| Comment | File | Size | Author |
|---|---|---|---|
| #62 | interdiff.txt | 4.98 KB | gábor hojtsy |
| #62 | 2380457-views-schema-update-59.patch | 61.57 KB | gábor hojtsy |
| #58 | interdiff.txt | 1.61 KB | gábor hojtsy |
| #58 | 2380457-views-schema-update-58.patch | 58.93 KB | gábor hojtsy |
| #55 | interdiff.txt | 32.14 KB | gábor hojtsy |
Comments
Comment #1
gábor hojtsyAre you sure this is a Novice?
Comment #2
dawehnerEhem, its probably not. I did not expected to find so many of those problems, sorry.
Comment #3
vijaycs85Here is an update for items in issue summary:
1. FIXED.
2. FIXED - we got
nullby default in default views, however null is a valid boolean I guess?3. NOT FIXED - Agreed, we need to move all elements under views_query to views.query.views_query.
4. FIXED
5. FIXED
6. FIXED
7.
8.NOT FIXED - it is defined as boolean?
9. FIXED - It's there(core/modules/views/config/schema/views.data_types.schema.yml:503), but as string instead of integer.
Comment #4
vijaycs85Comment #5
vijaycs85Comment #6
vijaycs85Comment #7
vijaycs85Comment #9
gábor hojtsyFound and opened #2381973: View wizard creates 'invalid' views out of the box, missing plugin_ids, insecure permissions.
Comment #10
vijaycs85Updating views according to schema changes.
Comment #12
dawehner... sorry but didn't we talked about moving this to sql?
Comment #13
gábor hojtsyAre all changes covered by tests?
Comment #14
vijaycs85it is in sql @dawehner, we removed the base data type views_query.
Nope, we just got the ConfigDefaultTest for now.
Comment #15
gábor hojtsyComment #16
gábor hojtsySo the test views have a test at #2325269: Test and fix views in test_views directories against their configuration schema, let's move test view changes there? This issue can do the non-test view changes, which do have test coverage. The others have the coverage there.
Comment #17
gábor hojtsyI realise this changes schemas and adapts test views. However once #2325269: Test and fix views in test_views directories against their configuration schema lands, test views will actually have schema testing, so I would suggest to continue doing this issue once that lands, when all the changes will be covered by tests :) Win!
As for the pager_options boolean to sequence change here, that is actually a leftover in my understanding. It is being removed in #2331793: Changing pager settings for this display only also changes pager settings for other display (and previously in #2385107: Cleanup legacy [plugin]_options from views displays).
Comment #18
gábor hojtsyParts of this may also be applicable in #2385805: Views tests don't pass strict schema checking which concerns itself for the fails reproducible with current tests, so not ones that this may fix that are not currently tested. I will keep an eye if this has good fixes for there in which case we found the test counterpart. Will take care to include commit credit suggestions as appropriate.
Comment #19
vijaycs85Ok, let's try the same patch in #10 again and fix the failed test cases?
Comment #21
vijaycs85Reroll of #10
Comment #23
dawehnerThat is postponed on #2331793: Changing pager settings for this display only also changes pager settings for other display
Urgs, someone seriously should consider to rename the sql based query plugin.
Comment #24
olli commented#2331793: Changing pager settings for this display only also changes pager settings for other display landed, reroll.
Comment #27
gábor hojtsy@vijaycs85: still working on this one?
Comment #29
jibranI have some fails here https://qa.drupal.org/pifr/test/956818 for my contrib style plugin which are related to views schema this http://www.privatepaste.com/497076a1f0 fixes the issue for me locally.
@dawehner can we add these to list? views.view.*:display.default.display_options.style.provider and views.view.*:display.default.display_options.fields.name.provider
Comment #30
berdirProvider should no longer exist in your views, just remove it.
Comment #31
jibranThanks @Berdir and @Gábor Hojtsy it did fix the tests. https://qa.drupal.org/pifr/test/956898
Comment #32
catchI don't think we want to write an upgrade path for this, and I don't think we want broken Views schema until 9.x (i.e. if this ended up 'upgrade path deadline', so bumping to critical. Looks pretty close.
Comment #33
gábor hojtsyAre the things to fix collected "randomly" in the summary or is there some pattern to them? The issue title does not sound very confident that this is in some way exhaustive. Then we would need yet another issue critical to discover more of them? Or how do we plan to go about this?
Comment #34
catchFollowing on from #32, config schema affects default config (as shown in the patch), so changing it in a way that wouldn't be consistent with default configuration is something we should almost certainly not do after 8.0.0 since it could break contrib/custom modules and install profiles.
Comment #35
gábor hojtsy@catch: I do agree it would be better if these are fixed, I don't see the pattern yet and therefore its hard to see if this is exhaustive and how would we find others. Or I'm missing some stuff here.
Comment #36
catch@Gabor I'm having the same issue as you with that, not clear at all how we know whether we got everything or not.
Comment #37
gábor hojtsyRerolled as a start.
Comment #38
gábor hojtsyMore than 0 bytes are involved with this issue, but this was clearly the quickest way to get the issue to green...
Comment #41
gábor hojtsyFixed incorrectly boolean query_comment and incorrectly string max_length values found.
Comment #43
gábor hojtsyFixed delta_offset values where they were strings and should be ints.
Unfortunately delta_limit cannot be an int, unless you want to use null instead of 'all'. @dawehner?
Fixed places where not should be boolean not string.
Should still fail at least on one remaining query schema.
Comment #44
gábor hojtsyAdding schema for query_test too.
Comment #47
gábor hojtsyfield_langcode_add_to_query was removed in #2394883: Language setup for entity and field based rendering in views is independent, confusing UI, lacking test coverage just now, so no need to fix it anymore :D Rerolled.
Comment #48
gábor hojtsyOh, the query test schema was already defined but used an undefined base type. Fixing that instead.
Comment #50
gábor hojtsyAdded remaining tasks based on what is not yet covered in the patch.
Comment #51
gábor hojtsyNo, the pager_options one needs to go, it was resolved in #2385107: Cleanup legacy [plugin]_options from views displays.
Comment #52
gábor hojtsyAs for views.filter.boolean:
which is
And then
So this one looks all good, removing from the todo list.
Comment #53
gábor hojtsyAnd finally on views_display:defaults:* should all be boolean only display_description was incorrectly label typed there. Should be boolean. Let's see what will this one break.
Comment #54
tstoecklerWow, awesome work everyone. Will try to review this later. For now, a shameless plug:
#2418481: Views more text cannot be translated
Comment #55
gábor hojtsy@dawehner looked at the patch and says max_length should be 0 where it is null now, and looking at its uses, makes sense. It does not have a unique null value to differentiate any condition.
Comment #56
dawehnergrr ... d.o. protected when you just post a comment
We discussed about delta_limit and IMHO we could make it a integer on a follow up, by assigning 0 or -1 as the 'all' value.
In case we do that we maybe also want to allow to setup this up using by extending the existing select field.
... Technically this should be certainly a views query, shouldn't it, just by looking at the class hierarchy
Comment #57
gábor hojtsyre: delta_limit: if we are to change the type, we should do it here, this is critical so we can match the config to the PHP and the other way around without needing upgrade path stuff
re: views query, we removed the base type for views queries because the base class does not have any options supported; so we could add one empty mapping for data modeling's sake if you prefer, but there are no base options, so that is why the SQL one is also defined out of a mapping, not some base type
Comment #58
gábor hojtsyRestoring the views_query base type as an empty mapping as per @dawehner's suggestion.
Comment #59
gábor hojtsyUsing 0 as the special case for delta_limit instead of 'all' as suggested.
Comment #60
dawehnerThank you for adapting it!
In an ideal world I would -1, because this is what other people use for unlimited (aka. other constant) but I think its fine for now.
Opened a related description follow up, see #2420865: Add a description for views field to explain the magic "0/all" values
Comment #61
dawehner@Gábor Hojtsy
No idea how I managed to kill your files, do you mind to reupload them?
Does the needs tests tag still apply to this issue?
Comment #62
gábor hojtsyReuploading #59 patches which d.o ate.
Comment #63
gábor hojtsyWe introduced the full-on schema testing which failed plenty above when we changed schema only, so I think that coverage is plenty.
Comment #64
dawehnerFair.
Comment #65
yesct commentedI dont know why #59 didn't get sent to the testbot, but I added it as an example on the d.o issue #2420915: patches on issues not being sent to testbot for testing
Comment #66
dawehnerWell in that case this is the symptom which happens if you accidentally remove a file, no idea though how this happens, to be honest.
Comment #67
alexpottThat looks like it has been resolved.
Comment #68
gábor hojtsyDone that. Sorry for not having it updated.
Comment #69
webchickOk this one looks like an enormous pain in the patootie to re-roll, so let's get it in.
Committed and pushed to 8.0.x. Thanks!
Comment #71
gábor hojtsyYay, thanks. Published change record.