Problem

When configuration schemas were written, the langcode and uuid keys were not consistently added.

Proposal

1. A langcode can appear in any configuration file, but as a general rule, files which have a label or text type should have a langcode schema key. That is, since the label and text types are used to designate textual configuration that is in a human language, it makes direct sense that the configuration file would define which language is that. This langcode is always at the top level of the file in the top level mapping. The langcode may not appear in the shipped configuration, however it is not a problem to define optional elements in the schema.

2. Any configuration .yml file that is a result of a config entity should have a uuid schema element defined. The configuration entities have uuids to uniquely identify them in the system. The uuid may not appear in the shipped configuration entity, however it is not a problem to define optional elements in the schema.

Related Issues

Files: 
CommentFileSizeAuthor
#6 1947814-langcode-config-schema-6.patch8.39 KBYesCT
PASSED: [[SimpleTest]]: [MySQL] 54,101 pass(es). View
#6 interdiff-4-6.txt2.13 KBYesCT
#4 1947814-langcode-config-schema-4.patch8.38 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 54,198 pass(es). View
#4 1947814-diff-2-4.txt3.32 KBvijaycs85
#2 1947814-langcode-config-schema-1.patch5.6 KBvijaycs85
FAILED: [[SimpleTest]]: [MySQL] 54,145 pass(es), 2 fail(s), and 0 exception(s). View

Comments

Gábor Hojtsy’s picture

Issue summary: View changes

Emphasize second condition.

vijaycs85’s picture

Schemas that are missing langcode:

With label field(s), no langcode:
contact.category.*
image.effects.*
system.site
menu.menu
user.settings
user.role.*
views.view.*

With text field(s), no langcode:
system.maintenance
system.rss
tour.tip.text
views.display.*
views.display.page
views.display.block

vijaycs85’s picture

Status: Active » Needs review
FileSize
5.6 KB
FAILED: [[SimpleTest]]: [MySQL] 54,145 pass(es), 2 fail(s), and 0 exception(s). View

Added two additional fixes that are not related to this issue, but good to have here (instead of two novice issues):

1. Added status field to schema for contact.category.*
2. Updating message text with quotes in system.maintenance.yml.

Status: Needs review » Needs work

The last submitted patch, 1947814-langcode-config-schema-1.patch, failed testing.

vijaycs85’s picture

Status: Needs work » Needs review
FileSize
3.32 KB
8.38 KB
PASSED: [[SimpleTest]]: [MySQL] 54,198 pass(es). View

In this patch:

1. Adding UUID to missing config entity's schema
2. Updating shortcut.set.default to shortcut.set.* and created an issue #1964588: Complete Configuration schemas for shortcut module for remaining tasks in this module schema.
3. Updated test cases that are failing in #2

Created new issue for picture module at #1964592: Create configuration schemas for picture module

Gábor Hojtsy’s picture

Priority: Minor » Normal
Status: Needs review » Reviewed & tested by the community

That all looks good to me :) Superb.

YesCT’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
2.13 KB
8.39 KB
PASSED: [[SimpleTest]]: [MySQL] 54,101 pass(es). View
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigSchemaTest.phpundefined
@@ -89,6 +89,10 @@ function testSchemaMapping() {
+      'label' =>  'Default language',

@@ -104,6 +108,8 @@ function testSchemaMapping() {
+    $expected['mapping']['langcode']['label'] =  'Default language';

extra white space.

+++ b/core/modules/image/config/schema/image.schema.ymlundefined
@@ -34,6 +34,10 @@ image.style.*:
+
 

+++ b/core/modules/system/config/schema/system.schema.ymlundefined
@@ -90,6 +96,9 @@ system.date:
 
 

a couple extra newlines taken out.

======
This was just the stuff changed in this patch. If we want later, we can do a cleanup through all the schema files.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Good improvements, no change to functionality :)

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed b92c56b and pushed to 8.x. Thanks!

Gábor Hojtsy’s picture

Issue tags: -sprint

Superb, thanks!

YesCT’s picture

what is status:
in config yml files?
Is it something we should check all the schemas for also? (would need an issue)

See for example the saved active config on the admin user role:
sites/default/files/config_mW...../active/user.role.administrator.yml
and compare it to: core/modules/user/config/schema/user.schema.yml

See #1942178-5: Make User module active config save format match the default yml file.

Gábor Hojtsy’s picture

Status is a built-in property of config entities, so config entities like user roles, filter formats, etc. can have it. Some config entities redefine exported properties, so maybe not all of them export status.

Status: Fixed » Closed (fixed)

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

mradcliffe’s picture

Created follow-up minor bug, #2000232: Block schema has two uuid keys.

mradcliffe’s picture

Issue summary: View changes

added meta to add schema as related