Problem/Motivation

We have a nice ConfigSchemaChecker in core which we use for testing. We do not enable it by default (i.e. "on production") for performance reasons and because schema violations are generally developer errors and shouldn't occur on stable systems.

However, for local development environments, it would be great to enable ConfigSchemaChecker.

Proposed resolution

We already have a mechanism for standardizing best-practice development settings: example.settings.local.php and development.services.yml.

Let's add \Drupal\Core\Config\Testing\ConfigSchemaChecker to development.services.yml. Consider adding a todo to move it out of the Testing namespace in D9.

And decide on the namespace. There was an initial suggestion of 'Drupal\Core\Config\Schema\ConfigSchemaChecker'. And later the patch used '\Drupal\Core\Config\Devel\ConfigSchemaChecker', which was changed to '\Drupal\Core\Config\Development\ConfigSchemaChecker'.

Is the current namespace '\Drupal\Core\Config\Development\ConfigSchemaChecker' the one to use or something else?

Update 15-04-2025:
\Drupal\Core\Config\Development\ConfigSchemaChecker seems like a decent enough namespace.

Remaining tasks

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Create a patch Instructions
Reroll the patch if it no longer applies. Instructions

User interface changes

None.

API changes

Because we recommend copying example.settings.local.php directly and that directly includes development.services.yml this constitutes a change in behavior for people that have the local settings enabled. I.e. if they violating config, they will not be able to re-save the config after this change.

Data model changes

None.

CommentFileSizeAuthor
#104 2625212-nr-bot.txt1.56 KBneeds-review-queue-bot
#94 config-warning.png6.75 KBchi
#93 2625212-93.patch3.57 KBbircher
#89 interdiff-2625212-88-89.txt1.68 KBbircher
#89 2625212-89-2.patch2.85 KBbircher
#88 2625212-89.patch3 KBbircher
#65 2625212-rollback.patch462 byteststoeckler
#57 add_configschemachecker-2625212-55.patch13.88 KBfaline
#57 interdiff-2625212-47-55.txt5.65 KBfaline
#54 interdiff-2625212-47-54.txt5.41 KBfaline
#54 add_configschemachecker-2625212-54.patch13.65 KBfaline
#50 interdiff-2625212-47-50.txt4.59 KBfaline
#50 add_configschemachecker-2625212-50.patch13.63 KBfaline
#48 add_configschemachecker-2625212-47.patch12.82 KBfaline
#48 interdiff-2625212-40-47.txt4.82 KBfaline
#46 interdiff-2625212-40-46.txt5.28 KBfaline
#46 add_configschemachecker-2625212-46.patch13.38 KBfaline
#40 add_configschemachecker-2625212-40.patch12.55 KBfaline
#40 interdiff-2625212-31-40.txt9.5 KBfaline
#36 interdiff-2625212-31-36.txt6.25 KBfaline
#36 add_configschemachecker-2625212-36.patch11.6 KBfaline
#31 add_configschemachecker-2625212-31.patch14.9 KBkostyashupenko
#27 add_configschemachecker-2625212-27.patch11.53 KBcilefen
#27 interdiff.txt10.56 KBcilefen
#25 add_configschemachecker-2625212-25.patch11.42 KBcilefen
#25 interdiff-19-25.txt1.01 KBcilefen
#22 add_configschemachecker-2625212-22.patch10.64 KBsnehi
#22 interdiff.txt731 bytessnehi
#19 add_configschemachecker-2625212-19.patch14.5 KBcilefen
#18 add_configschemachecker-2625212-18.patch0 bytescilefen
#15 enable-config-schema-checker-2625212-15.patch1.23 KBkrishnan.n
#12 enable-config-schema-checker-2625212-12.patch1.08 KBkrishnan.n
#6 interdiff-2625212-3-6.txt380 bytesokay19
#6 enable-config-schema-checker-2625212-6.patch883 bytesokay19
#3 enable-config-schema-checker-2625212-3.patch365 bytesokay19

Issue fork drupal-2625212

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tstoeckler created an issue. See original summary.

dawehner’s picture

Nice idea!

okay19’s picture

StatusFileSize
new365 bytes

Here is a patch for this issue.

okay19’s picture

Assigned: Unassigned » okay19
Status: Active » Needs review
cs_shadow’s picture

Status: Needs review » Needs work

Please add a todo comment in the `ConfigSchemaChecker` class suggesting it to be moved out of `Testing` namespace in D9 so that we don't forget to do so.

okay19’s picture

Added the todo in the ConfigSchemaChecker class.

okay19’s picture

Assigned: okay19 » Unassigned
Status: Needs work » Needs review
cs_shadow’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
    @@ -5,6 +5,7 @@
    +// @todo Move out of Testing namespace in Drupal 9.
    

    @todo's without issues aren't correct. Plus we could copy the class to the "correct" place now and just make the existing on extend from that.

  2. +++ b/sites/development.services.yml
    @@ -5,3 +5,5 @@
    +  config.checker.schema:
    +    class: Drupal\Core\Config\Testing\ConfigSchemaChecker
    

    I think this needs to be be tagged with...

        tags:
          - { name: event_subscriber }
    

    Otherwise it is not going to work.

krishnan.n’s picture

@alexpott:

  • About namespace, do you see SchemaChecker being used anywhere other than during development? If so, should we use "Devel" or "Development" as the namespace? That way, we could add other devel only config classes into this namespace
  • As for the tag, we need name: event_subscriber because the ConfigSchemaChecker implement EventSubscriberInterface, correct? So, we just need to add the line you'd mentioned?

We can create a patch once we have the namespace in place.

tstoeckler’s picture

About namespace, do you see SchemaChecker being used anywhere other than during development? If so, should we use "Devel" or "Development" as the namespace? That way, we could add other devel only config classes into this namespace

@krishnan: I think an appropriate namespace would be Drupal\Core\Config\Schema\ConfigSchemaChecker. Needless to say, you or @alexpott, or anyone else: feel free to disagree.

As for the tag, we need name: event_subscriber because the ConfigSchemaChecker implement EventSubscriberInterface, correct? So, we just need to add the line you'd mentioned?

Yes, exactly. Thanks @alex-eagle-eye-pott for catching that! Totally missed that in my review.

krishnan.n’s picture

  • Patch contains namespace/directory as ./Drupal/Core/Config/Schema/ConfigSchemaChecker.
  • Added the "tags: ... to development.services.yml"

Think this patch is invalid and here more for reference -- don't think the directory rename is in the patch. Did a 'git diff -M10%' but that doesn't seem to have worked; putting this anyways so someone else (or a clearer me) can clean up later.

cilefen’s picture

+++ b/core/lib/Drupal/Core/Config/Schema/ConfigSchema/ConfigSchemaChecker.php
@@ -2,10 +2,10 @@
-namespace Drupal\Core\Config\Testing;
+namespace Drupal\Core\Config\ConfigSchemaChecker;

You cannot change the namespace without also moving the class to the new directory, as in, on the file system.

dawehner’s picture

Does someone mind explaining how this actually works at the moment? How can Drupal find this class?

krishnan.n’s picture

StatusFileSize
new1.23 KB

Thanks to cilefen; have the directory move as part of the patch (Hopefully)

rashid_786’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 15: enable-config-schema-checker-2625212-15.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
Issue tags: +Needs issue summary update
StatusFileSize
new0 bytes

Someone please update the issue summary when the namespace decision is made. This is going with "Devel" for the namespace.

cilefen’s picture

StatusFileSize
new14.5 KB
cilefen’s picture

+++ b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
@@ -25,87 +16,9 @@
+ * @deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0. Use
+ *   Instead use Drupal\Core\Config\Devel\ConfigSchemaChecker.

Oops, I messed up the first line here.

The last submitted patch, 18: add_configschemachecker-2625212-18.patch, failed testing.

snehi’s picture

StatusFileSize
new731 bytes
new10.64 KB

Changed it. Please review.

Status: Needs review » Needs work

The last submitted patch, 22: add_configschemachecker-2625212-22.patch, failed testing.

tstoeckler’s picture

Not excited about the "Devel" namespace, but OK...

+class ConfigSchemaChecker extends \Drupal\Core\Config\Devel\ConfigSchemaChecker {

Please add an appropriate use statement instead of referencing the full namespace inline.

The latest patch seems to miss the adding of the new file, which is why it fails. Also it would be good to roll the patch with the -C option, so that the patch is smaller.

cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.01 KB
new11.42 KB

@tstoeckler I do not understand your namespace suggestion in #11 and I regret ignoring it rather than just saying so.

dawehner’s picture

Just a nitpick, let's use 'Development' instead of 'Devel', we don't use abbrev. in our variables, so ideally also not in namespaces.

cilefen’s picture

StatusFileSize
new10.56 KB
new11.53 KB

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: -Needs issue summary update +Needs reroll

Patch no longer applies.

Updated issue summary to indicate that a reroll is needed and to indicate that the namespace needs to be agreed on. At least, it wasn't clear to me that there is agreement on using the 'Development' namespace.

Leaving as novice for the reroll.

kostyashupenko’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new14.9 KB

reroll of #27. There was only one little conflict at this file /core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php

dawehner’s picture

Just some nitpicks. I think this looks overall great.

  1. +++ b/core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php
    @@ -0,0 +1,111 @@
    +/**
    + * @file
    + * Contains \Drupal\Core\Config\Development\ConfigSchemaChecker.
    + */
    

    This is no longer needed

  2. +++ b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
    @@ -19,88 +12,10 @@
    + * @deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0.
    + *   Use Drupal\Core\Config\Development\ConfigSchemaChecker.
    

    Let's update that to 8.3.0

wim leers’s picture

Priority: Normal » Major

I think this at least major for the DX. Agree this looks great!

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Both nitpicks can be fixed on commit.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. This is a really nice idea
  2. The patch should be created with the following gitconfig...
    [diff]
    	renames = copies
    

    So it is eay to tell no unnecessary changes have occurred in the new class. See https://www.drupal.org/documentation/git/configure

  3. +++ b/core/modules/simpletest/src/KernelTestBase.php
    @@ -321,7 +321,7 @@ public function containerBuild(ContainerBuilder $container) {
    -        ->register('simpletest.config_schema_checker', 'Drupal\Core\Config\Testing\ConfigSchemaChecker')
    +        ->register('simpletest.config_schema_checker', 'Drupal\Core\Config\Development\ConfigSchemaChecker')
    
    +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
    @@ -608,7 +608,7 @@ public function register(ContainerBuilder $container) {
    -        ->register('simpletest.config_schema_checker', 'Drupal\Core\Config\Testing\ConfigSchemaChecker')
    +        ->register('simpletest.config_schema_checker', 'Drupal\Core\Config\Development\ConfigSchemaChecker')
    

    ConfigSchemaChecker::class and a use statement would be preferable.

  4. Let's address #32 too
faline’s picture

Creating the patch with changes in #32 and #35
(including gitconfig:

[diff]
	renames = copies

)

tstoeckler’s picture

+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -321,7 +322,7 @@
+        ->register('simpletest.config_schema_checker', 'ConfigSchemaChecker')

This should be ConfigSchemaChecker::class (without quotes)

wim leers’s picture

  1. --- b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
    +++ b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
    

    This file is no longer being moved.

  2. +++ b/core/modules/simpletest/src/KernelTestBase.php
    @@ -321,7 +322,7 @@
    +        ->register('simpletest.config_schema_checker', 'ConfigSchemaChecker')
    
    +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
    @@ -608,7 +609,7 @@
    +        ->register('simpletest.config_schema_checker', 'ConfigSchemaChecker')
    

    ConfigSchemaChecker::class

    The current code will fail.

faline’s picture

Sorry @Wim Leers, I should remove the `core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php` file?

faline’s picture

Fixing Patch

faline’s picture

Status: Needs work » Needs review
wim leers’s picture

Status: Needs review » Reviewed & tested by the community

Looks perfect :)

The last submitted patch, 36: add_configschemachecker-2625212-36.patch, failed testing.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -547,7 +547,7 @@ protected function prepareSettings() {
-        'class' => 'Drupal\Core\Config\Testing\ConfigSchemaChecker',
+        'class' => 'Drupal\Core\Config\Development\ConfigSchemaChecker',

I missed one... sorry...

Also as we're deprecating something we should have a CR to tell developers about this.

faline’s picture

@alexpott on BrowserTestBase is also call for use Drupal\Core\Config\Testing\ConfigSchemaChecker. Should I change here to use the Drupal\Core\Config\Development\ConfigSchemaChecker, right?

faline’s picture

Status: Needs work » Needs review
StatusFileSize
new13.38 KB
new5.28 KB

updating patch

Status: Needs review » Needs work

The last submitted patch, 46: add_configschemachecker-2625212-46.patch, failed testing.

faline’s picture

Status: Needs work » Needs review
StatusFileSize
new4.82 KB
new12.82 KB

Fixing patch #46

alexpott’s picture

Status: Needs review » Needs work

Yep we need to fix the usage in \Drupal\Tests\BrowserTestBase - still not fixed in #48 - well spotted to @faline. And there is an @see to fix in there too.

faline’s picture

Sorry @alexpott I forgot to include the change on BrowserTestBase.
Now the fixed patch included the @see fiz too.

faline’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 50: add_configschemachecker-2625212-50.patch, failed testing.

tstoeckler’s picture

Thanks for your great effort on this @faline! I reeeaallly wanted to RTBC this one, but I looked at the changes to the @see statements, and I think they're not correct. Concrete notes below:

  1. +++ b/core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php
    @@ -19,7 +19,7 @@
    - * @see \Drupal\KernelTests\KernelTestBase::register()
    + * @see \Drupal\simpletest\KernelTestBase::containerBuild()
    
    +++ b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
    @@ -19,88 +12,10 @@
    - * @see \Drupal\KernelTests\KernelTestBase::register()
    + * @see \Drupal\simpletest\KernelTestBase::containerBuild()
    

    We should keep the old reference. I think it's good to add the one in simpletest Module, but the old one is still (just as) valid.

  2. +++ b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php
    @@ -19,88 +12,10 @@
    - * @see \Drupal\KernelTests\KernelTestBase::register()
    + * @see \Drupal\simpletest\KernelTestBase::containerBuild()
    

    Same here.

    Or we could remove all current @see's and just add a @see to the new class.

  3. +++ b/sites/development.services.yml
    @@ -7,3 +7,8 @@ parameters:
    +  config.checker.schema:
    

    This makes it seems like "checker" is a separate namespace. Maybe "config.schema_checker" ?

faline’s picture

@tstoeckler I keep both @see references, old and new one, what do you think?

tstoeckler’s picture

Status: Needs work » Reviewed & tested by the community

Awesome, thank you very much!

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs work

Oh, we still need a change record, but other than that, this is good to go.

faline’s picture

@tstoeckler I forgot to change this point: @see on \Drupal\Tests\BrowserTestBase as @alexpott told on comment #49

The last submitted patch, 54: add_configschemachecker-2625212-54.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Reviewed & tested by the community

Thanks @faline for the change notice, this is now ready to go.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 57: add_configschemachecker-2625212-55.patch, failed testing.

joelpittet’s picture

Status: Needs work » Reviewed & tested by the community

Testbot failure, resetting status due to https://www.drupal.org/node/2828045

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.3.x, thanks!

  • catch committed 19006b5 on 8.3.x
    Issue #2625212 by faline, cilefen, okay19, krishnan.n, snehi,...

Status: Fixed » Closed (fixed)

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

tstoeckler’s picture

Status: Closed (fixed) » Needs review
Issue tags: -Needs change record
StatusFileSize
new462 bytes

This has caused problems for upgrade functions which save config, so I think this should be rolled back.

At the very least we should check whether the config is explicitly trusted, and if so, we should not do anything.

Even then, though, this might be a risky change in case update functions (wrongly) do not trust data. See #2838370: system_update_8200 is not trusting the data when re-saving all configs but it should for an example of this.

Since this included a class rename, though, which makes sense regardless of enabling it by default or not, I don't think this should be rolled back in the sense of git revert. Instead I think we should do the attached patch.

tstoeckler’s picture

Title: Add ConfigSchemaChecker to development.services.yml » [rollback] Add ConfigSchemaChecker to development.services.yml
dawehner’s picture

On top of that I've also people struggling to use basically anything in the views UI due to issues like #2623568: Config schema of argument_default plugins is incorrect and some others. Of course they could change their development.services.yml, but that's not obvious.

Given that we should probably roll it back and figure out how to at least solve the update problem, as described by @tstoeckler

  • catch committed c346599 on 8.3.x
    Issue #2625212 by faline, cilefen, okay19, krishnan.n, snehi, tstoeckler...
catch’s picture

Committed #64 to roll this back.

  • catch committed 19006b5 on 8.4.x
    Issue #2625212 by faline, cilefen, okay19, krishnan.n, snehi,...
  • catch committed c346599 on 8.4.x
    Issue #2625212 by faline, cilefen, okay19, krishnan.n, snehi, tstoeckler...

  • catch committed 19006b5 on 8.4.x
    Issue #2625212 by faline, cilefen, okay19, krishnan.n, snehi,...
  • catch committed c346599 on 8.4.x
    Issue #2625212 by faline, cilefen, okay19, krishnan.n, snehi, tstoeckler...

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

chi’s picture

Issue tags: -Novice

What if the checker will emit an error instead of throwing an exception? We could make the behavior configurable to preserve exceptions for testing. This checker is really needed for local development.

chi’s picture

Meanwhile I just created a simple module to test how it could work.

alexpott’s picture

Title: [rollback] Add ConfigSchemaChecker to development.services.yml » Add ConfigSchemaChecker to development.services.yml

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jhedstrom’s picture

Status: Needs review » Needs work

This is at NW if it's still something being pursued at all.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mxr576’s picture

We are using config schema checker as a default dev requirement in our all our projects and possibly there is a similar issue with it that was mentioned in #65. I do not have full details yet, but it seems when contrib modules changes their config schema in a release and also remove their old config definitions (afaik there is no policy for not doing that in a non-major version) then the update process (updb && cim) fails false positively with config scheme validation error.

Eg.: https://www.drupal.org/project/eu_cookie_compliance/issues/3210365#comme...

tstoeckler’s picture

I was going to comment in that issue that the problem is that in hook_update_N() the $has_trusted_data parameter should be set to TRUE when saving config and that that would avoid the use of the schema checker. While it's true that that parameter should be set, looking at the code I don't think the schema checker would actually be influenced by that. I think we should open an issue for that as that means the schema checker cannot be activated during config updates in hook_update_N() which in turn means that it's not safe to "Just always have it on" even for development environments. I may be totally mistaken, though, I didn't play around with this locally.

berdir’s picture

Had a crosspost.

> fails false positively with config scheme validation error.

That's not a false positive, that's the expected behavior then. Removing the schema means it's no longer valid. Yes, not, running it during updates might make sense, but even then, just removing the schema is tricky.

Drupal 9 now has a way to deprecate config schema, but that's AFAIK quite new and contrib won't have picked that up yet. But that's probably the way forward for most cases.

bircher’s picture

Status: Needs work » Needs review
StatusFileSize
new3 KB

What if we add the schema validation as a warning when one saves the config. (ie idea from #74)

I understand that we can not just throw an exception on developers machines, especially given the state of config schema in contrib (and probably even worse in custom code). I think it is mostly due to developers not being aware of the importance or even existence of config schema. One might naively think "my config doesn't need to be translated, therefore, I don't need a schema for it".

So if there were a warning all of a sudden, maybe people would look what it is about and fix it. Maybe we need to add a link to a documentation page about config schema.

But here is a attempt to get this back on track. I think we need schema validation, but I also think first we need to raise awareness of how important config schema is.

bircher’s picture

StatusFileSize
new2.85 KB
new1.68 KB

Ok I guess it should adhere to coding standards for people to review :D

Status: Needs review » Needs work

The last submitted patch, 89: 2625212-89-2.patch, failed testing. View results

chi’s picture

Status: Needs work » Needs review

The current change record is outdated.

chi’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record updates
bircher’s picture

Status: Needs work » Needs review
StatusFileSize
new3.57 KB

Oh, of course both files need to have the same content... should have known.

We should probably debate the message if we agree to take this route.

chi’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new6.75 KB

Looks good to me. I am using this approach #93 for a few years. It helped me to discover many config schema issues in custom code and contrib.

chi’s picture

Config warning screenshot
The message is a bit confusing. I know it comes from the exception but since it's now showed in admin UI can we improve wording somehow?
For people that are not familiar with Drupal Configuration system it could be hard understand what's wrong.

I expect many Drupal developers will get this message on their local hosts. So the CR should have some explanation of what configuration schema is and how to fix errors in it, probably with some links to the documentation on drupal.org.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 93: 2625212-93.patch, failed testing. View results

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

bbrala made their first commit to this issue’s fork.

bbrala’s picture

Status: Needs work » Needs review
Issue tags: +Configuration system, +validation, +Configuration schema

Updated the CR, updated the message to be more helpful and also show a link to the documentation. Tests seem green. Let's see if we can continue here.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.56 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

bbrala’s picture

Status: Needs work » Needs review

Removed new forbidden word "please" from the message.

smustgrave’s picture

Status: Needs review » Needs work

1 small comment but

Consider adding a todo to move it out of the Testing namespace in D9.

And decide on the namespace. There was an initial suggestion of 'Drupal\Core\Config\Schema\ConfigSchemaChecker'. And later the patch used '\Drupal\Core\Config\Devel\ConfigSchemaChecker', which was changed to '\Drupal\Core\Config\Development\ConfigSchemaChecker'.

Is the current namespace '\Drupal\Core\Config\Development\ConfigSchemaChecker' the one to use or something else?

Is the todo still needed?

Has the namespace been decided?

godotislate’s picture

Added a couple small grammar suggestions.

bbrala’s picture

Issue summary: View changes

We can decide the namespace, i think this placement is all good.

bbrala’s picture

Status: Needs work » Needs review

Applied suggestion for grammar and adjusted contructor.

smustgrave’s picture

+1 from me.

godotislate’s picture

Nit: add readonly to the promoted properties. Otherwise can RTBC.

bbrala’s picture

Yeah, might as well, good one.

godotislate’s picture

There are test failures. Might need rerunning?

smustgrave’s picture

Re-run seemed to do the trick. Believe all feedback has been addressed

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

The CR is no longer correct as the class is not moving. I do think that the CR should exist - it should detail that by default if you use the development.services.yml you will can warnings when saving configuration that does not comply with schema. Once the CR is updated this can be set back to RTBC. The solution looks elegant and it's great that this emits warnings rather than errors.

bbrala’s picture

Status: Needs work » Reviewed & tested by the community

CR has been updated.

borisson_’s picture

CR looks great.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs change record updates

Committed 733dc5f and pushed to 11.x. Thanks!

  • alexpott committed 733dc5fc on 11.x
    Issue #2625212 by faline, bbrala, cilefen, bircher, okay19, krishnan.n,...

Status: Fixed » Closed (fixed)

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