This is a sub-issue of #1910606: Improve the configurations schemas for Views significantly.

Problem/motivation

#1866610: Introduce Kwalify-inspired schema format for configuration introduced some config schema coverage for views and #1910606: Improve the configurations schemas for Views significantly extended it, but it is not complete. The changelog leads to (hopefully extensive) documentation on the format at http://drupal.org/node/1905070. While there are little cleanups planned for the format overall, the current format is a result of months of back and forths, so it should be perfectly fine to apply it more widely to core.

Proposed solution

Figure out the missing pieces that are not yet covered. Write schema file sections for them. Clean up / fix any issues in current schema.

Create a configuration schema for missing view arguments plugins

Schema in place
Please refer core/modules/views/config/schema/views.argument.schema.yml
ManyToOne.php
Null.php
Numeric.php
String.php

Schema not yet in place
Broken.php
Date.php
DayDate.php
Formula.php
FullDate.php
GroupByNumeric.php
MonthDate.php
Standard.php
WeekDate.php
YearDate.php
YearMonthDate.php

The UI for this data is shown under "Provide default value" when editing a contextual filter of a view. Generally an item in the dropdown equates to one file from the list above, and additional options for that file are shown when selecting it in the dropdown.

Steps to review

Check Steps to check on meta.

Files: 
CommentFileSizeAuthor
#14 2019069-views-argument-schema-14.patch1.86 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 57,210 pass(es). View
#12 2019069-views-argument-schema-12.patch1.84 KBNitesh Sethia
FAILED: [[SimpleTest]]: [MySQL] 56,359 pass(es), 37 fail(s), and 9 exception(s). View
#12 2019069-views-argument-schema-12-interdiff.txt1.65 KBNitesh Sethia
#11 2019069-views-argument-schema-11.patch1.83 KBNitesh Sethia
FAILED: [[SimpleTest]]: [MySQL] 56,382 pass(es), 37 fail(s), and 9 exception(s). View
#11 2019069-views-argument-schema-11-interdiff.txt1.64 KBNitesh Sethia
#10 2019069-views-argument-schema-10.patch1.46 KBdeepakaryan1988
PASSED: [[SimpleTest]]: [MySQL] 56,861 pass(es). View
#9 2019069-views-argument-schema-9.patch1.46 KBdeepakaryan1988
PASSED: [[SimpleTest]]: [MySQL] 56,724 pass(es). View
#7 2019069-views-argument-schema-7.patch1.48 KBdeepakaryan1988
PASSED: [[SimpleTest]]: [MySQL] 56,659 pass(es). View
#2 2019069-views-argument-schema-2.patch30.89 KBdeepakaryan1988
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2019069-views-argument-schema-2.patch. Unable to apply patch. See the log in the details link for more information. View
#1 2019069-views-argument-schema-1.patch31.41 KBdeepakaryan1988
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2019069-views-argument-schema-1.patch. Unable to apply patch. See the log in the details link for more information. View

Comments

deepakaryan1988’s picture

FileSize
31.41 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2019069-views-argument-schema-1.patch. Unable to apply patch. See the log in the details link for more information. View

patched for broken.php

deepakaryan1988’s picture

Assigned: Unassigned » deepakaryan1988
Status: Active » Needs review
FileSize
30.89 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2019069-views-argument-schema-2.patch. Unable to apply patch. See the log in the details link for more information. View

Broken.php
Date.php
DayDate.php
Formula.php
FullDate.php
GroupByNumeric.php
MonthDate.php
Standard.php
WeekDate.php
YearDate.php
YearMonthDate.php

Patches for rest of the All..

Status: Needs review » Needs work
Issue tags: -Configuration system, -D8MI, -language-config, -VDC, -Configuration schema, -views configuration schema

The last submitted patch, 2019069-views-argument-schema-2.patch, failed testing.

deepakaryan1988’s picture

Status: Needs work » Needs review
deepakaryan1988’s picture

Status: Needs review » Needs work
Issue tags: +Configuration system, +D8MI, +language-config, +VDC, +Configuration schema, +views configuration schema

The last submitted patch, 2019069-views-argument-schema-2.patch, failed testing.

deepakaryan1988’s picture

Status: Needs work » Needs review
FileSize
1.48 KB
PASSED: [[SimpleTest]]: [MySQL] 56,659 pass(es). View

Again clear everything and working on my local

vijaycs85’s picture

Status: Needs review » Needs work

Thanks for working on this @deepakaryan1988. Here is some review comments.

+++ b/core/modules/views/config/schema/views.argument.schema.ymlundefined
@@ -65,3 +65,67 @@ views.argument.string:
+    date:
+      type: date
+      label: 'date'
+    node_created:
+      type: date
+      label: 'node creation time'
+    node_changed:
+      type: date
+      label: 'node update time'
+

There is no data type called 'date' We need to check what type of data we are getting for these fields and need to set type accordingly. Refer system.data_types.schema.yml and views.data_types.schema.yml for available data types.

+++ b/core/modules/views/config/schema/views.argument.schema.ymlundefined
@@ -65,3 +65,67 @@ views.argument.string:
+      label: 'date'

+      label: 'node creation time'

+      label: 'node update time'

Needs better label and first character should be capital.

+++ b/core/modules/views/config/schema/views.argument.schema.ymlundefined
@@ -65,3 +65,67 @@ views.argument.string:
+  label: 'Day Date'
+
+  label: 'Full Date'
+
+  label: 'GroupBy Numeric'
+
+  label: 'Month Date'
+
+  label: 'Week Date'
+
+  label: 'Year Date'
+
+  label: 'YearMonthDate'

Just first character should be capital.

+++ b/core/modules/views/config/schema/views.argument.schema.ymlundefined
@@ -65,3 +65,67 @@ views.argument.string:
+  label: 'YearMonthDate'
\ No newline at end of file

Needs an empty line.

deepakaryan1988’s picture

FileSize
1.46 KB
PASSED: [[SimpleTest]]: [MySQL] 56,724 pass(es). View

@vijaya Everything is done now.
I also checked locally its working fine.
:)

deepakaryan1988’s picture

Status: Needs work » Needs review
FileSize
1.46 KB
PASSED: [[SimpleTest]]: [MySQL] 56,861 pass(es). View

Sorry for again uploading the patch but in previous one, I didn't change the status

Nitesh Sethia’s picture

FileSize
1.64 KB
1.83 KB
FAILED: [[SimpleTest]]: [MySQL] 56,382 pass(es), 37 fail(s), and 9 exception(s). View

Adding missing Arguments and re rolling the patch..

Nitesh Sethia’s picture

FileSize
1.65 KB
1.84 KB
FAILED: [[SimpleTest]]: [MySQL] 56,359 pass(es), 37 fail(s), and 9 exception(s). View

Adding missing Arguments and re rolling the patch..

Status: Needs review » Needs work

The last submitted patch, 2019069-views-argument-schema-12.patch, failed testing.

vijaycs85’s picture

Status: Needs work » Needs review
Issue tags: +LONDON_2013_JULY
FileSize
1.86 KB
PASSED: [[SimpleTest]]: [MySQL] 57,210 pass(es). View

Re-rolling with space fixes...

vijaycs85’s picture

Issue summary: View changes

Updated issue summary.

dawehner’s picture

+++ b/core/modules/views/config/schema/views.argument.schema.yml
@@ -65,3 +65,81 @@ views.argument.string:
+views.argument.date:
...
+    node_created:
...
+    node_changed:

It is a bit odd that the date handler knows of node_created/node_changed ... note: I don't have access to the code at the moment.

ianthomas_uk’s picture

Issue summary: View changes
ianthomas_uk’s picture

Status: Needs review » Needs work

The options for these files are stored under default_argument_options which is an argument_default type, so that's what we should be defining (e.g. views.argument_default.broken instead of views.argument.broken).

views.data_types.schema.yml:

    default_argument_options:
      type: views.argument_default.[%parent.default_argument_type]
      label: 'Default argument options'

I don't thinks all the files need a schema, as default_argument_type is just a string and some don't have any options.

I agree it's weird that Drupal\views\Plugin\views\argument\Date contains node-specific options, but I've checked and it does. We should probably open an issue to get those converted to their own subclasses.

The mapping for views.argument.date is wrong though, as Date.php injects node_created and node_changed into #options as alternatives for default_argument_type.

vijaycs85’s picture

Status: Needs work » Needs review

Thanks for the review. As you can see default_argument_type in parent can be either 'fixed' or 'raw'. All these in the files are argument types. Please refer /core/modules/views/lib/Drupal/views/Plugin/views/argument_default and /core/modules/views/lib/Drupal/views/Plugin/views/argument for more details.

dawehner’s picture

+++ b/core/modules/views/config/schema/views.argument.schema.yml
@@ -65,3 +65,81 @@ views.argument.string:
+
...
+
+views.argument.date_month:
+  type: views_argument
+  label: 'Month Date'
+  mapping:
+    month:
+      type: string
+      label: 'Month'
+
+views.argument.standard:
+  type: views_argument
+  label: 'Standard'

Should we just sort the the two ones the other way round?

dawehner’s picture

Status: Needs review » Needs work

.

vijaycs85’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#2167623: Add test for all default configuration to ensure schema exists and is correct

The patch on this issue has been updated as part of #2167623: Add test for all default configuration to ensure schema exists and is correct. As this issue doesn't have any test to confirm/validate the schema, making this change and closing this issue as duplicate of #2167623: Add test for all default configuration to ensure schema exists and is correct. The contributors of this issue (in commit message) is copied to #2167623: Add test for all default configuration to ensure schema exists and is correct.