This is a sub-issue of #1910624: [META] Introduce and complete configuration schemas in all of core.

Problem/motivation

#1866610: Introduce Kwalify-inspired schema format for configuration introduced the idea of config schema. 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

Create a configuration schema for forum module.

Schema in place

Schema not yet in place
forum.settings.yml

Files: 
CommentFileSizeAuthor
#10 1919176-forum-schema-10.patch1.39 KBcsg
PASSED: [[SimpleTest]]: [MySQL] 52,824 pass(es). View
#10 interdiff.txt591 bytescsg
#10 containers.png46.44 KBcsg
#9 1919176-forum-schema-9.patch1.4 KBsandipmkhairnar
FAILED: [[SimpleTest]]: [MySQL] Setup environment: Test cancelled by admin prior to completion. View
#9 forum-shema-forum.png16.25 KBsandipmkhairnar
#4 1919176-forum-schema-4.patch1.3 KBsandipmkhairnar
PASSED: [[SimpleTest]]: [MySQL] 52,256 pass(es). View
#2 1919176-forum-schema-2.png25.73 KBsandipmkhairnar
#2 1919176-forum-schema-2.patch1.32 KBsandipmkhairnar
PASSED: [[SimpleTest]]: [MySQL] 52,240 pass(es). View
#1 1919176-forum-schema-1.patch872 bytesvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 50,652 pass(es). View

Comments

vijaycs85’s picture

Status: Active » Needs review
FileSize
872 bytes
PASSED: [[SimpleTest]]: [MySQL] 50,652 pass(es). View

Adding schema file...

sandipmkhairnar’s picture

FileSize
1.32 KB
PASSED: [[SimpleTest]]: [MySQL] 52,240 pass(es). View
25.73 KB

updating schema as per code style in http://drupal.org/node/1905070#codestyle and verified in config_inspectorschema form

vijaycs85’s picture

Thanks @sandipmkhairnar, patch looks good except it needs a new line at the end.

sandipmkhairnar’s picture

FileSize
1.3 KB
PASSED: [[SimpleTest]]: [MySQL] 52,256 pass(es). View

Thanks @vijaycs85, updated patch as per the comment.

rteijeiro’s picture

Assigned: Unassigned » rteijeiro
Issue tags: +SprintWeekend2013

Reviewing and updated SprintWeekend tag.

tstoeckler’s picture

Assigned: rteijeiro » Unassigned
+++ b/core/modules/forum/config/schema/forum.schema.yml
@@ -0,0 +1,44 @@
+# Schema for the configuration files of the Forum module

This should end in a period.

+++ b/core/modules/forum/config/schema/forum.schema.yml
@@ -0,0 +1,44 @@
+# Schema for the configuration files of the Forum module

This should end in a period.

+++ b/core/modules/forum/config/schema/forum.schema.yml
@@ -0,0 +1,44 @@
+      type: string

Containers is not a string, but a sequence.

+++ b/core/modules/forum/config/schema/forum.schema.yml
@@ -0,0 +1,44 @@
+        hot_threshold:
+          type: integer
+          label: 'Hot topic threshold'

This might be a little picky, but I think this deserves a comment as well. Unless you're some kind of forum.module expert this is very hard to understand, and I doubt many people are...

+++ b/core/modules/forum/config/schema/forum.schema.yml
@@ -0,0 +1,44 @@
+        order:
+          type: integer
+          label: 'Default order'

This (as well as the actual config) should contain a comment referencing _forum_get_topic_order() because this is near impossible to understand without it.

+++ b/core/modules/forum/config/schema/forum.schema.yml
@@ -0,0 +1,44 @@
+      type: integer

The vocabulary ID is a string, not an integer. It is currently '0', by default, but it really should be ''.

+++ b/core/modules/forum/config/schema/forum.schema.yml
@@ -0,0 +1,44 @@
+      label: 'Forum vocabulary'

I think this should be 'Forum vocabulary ID' for clarity.

+++ b/core/modules/forum/config/schema/forum.schema.yml
@@ -0,0 +1,44 @@
+# Schema for the configuration files of the Forum module

This should end in a period.

tstoeckler’s picture

Crosspost, didn't mean to unassign.

rteijeiro’s picture

Assigned: Unassigned » rteijeiro
Status: Needs review » Needs work

I think that:

'vocabulary' => 'forums'

Should be 'string' not 'integer'. Am I right?

It's the one and only error I have found.

sandipmkhairnar’s picture

FileSize
16.25 KB
1.4 KB
FAILED: [[SimpleTest]]: [MySQL] Setup environment: Test cancelled by admin prior to completion. View

Thanks to @tstoeckler and @rteijeiro for comments. Corrected labels as per comment.
schema form

csg’s picture

Status: Needs work » Needs review
FileSize
46.44 KB
591 bytes
1.39 KB
PASSED: [[SimpleTest]]: [MySQL] 52,824 pass(es). View

Containers store taxonomy term ID's, so the type is integer instead of string.

rteijeiro’s picture

It seems that it's solved:

+++ b/core/modules/forum/config/schema/forum.schema.yml
@@ -0,0 +1,46 @@
+# Schema for the configuration files of the Forum module.

Ending in period.

+    containers:
+      type: sequence
+      label: 'Containers to group related forums'
+      sequence:
+        - type: string
+          label: 'Containers to group related forums'

Now containers is sequence.

+    vocabulary:
+      type: string
+      label: 'Forum vocabulary ID'

Now vocabulary is string and it's label is changed.

But I am not sure if there should be the comments mentioned in http://drupal.org/node/1919176#comment-7155320

I marked it as "needs review" so tstoeckler should review it better than me :)

csg’s picture

It seems the last review is for #9, so #10 has not been reviewed yet.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

I still think we could use some inline comments here, but since we haven't done that for most of the other schema files I won't be a stickler.

I'm not sure about the taxonomy term ID. It is currently stored as an integer in the DB, but we don't really enforce that in the entity system. I.e. someone could make taxonomy terms use the ConfigStorageController and use machine names for taxonomy terms. So maybe we should use string here. On the other hand the actual data is an integer, so I *think* it is correct to use integer.

I am (tentatively) marking this RTBC, and, thus, relaying this question to the core committers.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x, thanks! Will push once testbot's caught up a bit.

Automatically closed -- issue fixed for 2 weeks with no activity.