Closed (fixed)
Project:
Simplenews
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Aug 2018 at 11:46 UTC
Updated:
19 Mar 2019 at 12:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
saschahannes commentedComment #3
saschahannes commentedComment #4
saschahannes commentedComment #5
saschahannes commentedComment #6
tr commentedYes, that's a duplicate key and should be removed.
But how does node.type.simplenews_issue.yml pass schema validation? Not only is the "status" key duplicated, but the "settings" key is not valid, as per the node.type.* schema, neither are the 'has_title' or 'title_label' keys ...
Note the parent 'config_entity' schema defines keys like 'status' and 'langcode' etc - all the keys that are not present in the config_entity or node.type.* schema should be invalid.
Comment #7
adamps commentedPatch in #4 is correct, but should also correct the other mistakes pointed out in #6
There isn't really any schema validation:-) You can install a contrib module that checks the schema, but Drupal core doesn't really care!
Comment #8
berdir> There isn't really any schema validation:-) You can install a contrib module that checks the schema, but Drupal core doesn't really care!
There is during test execution. Drupal core very much cares then unless you explicitly opt out.
Comment #9
adamps commented@Berdir is right as usual. This causes a warning in various test including SimplenewsI18nTest.
Comment #10
andrewbelcher commentedHere's a patch that also includes test coverage of config directly. I'm not entirely sure why it doesn't pick up the other issues mentioned in #6...
Comment #11
andrewbelcher commentedHere's a patch that also addresses
has_titleandtitle_label.Comment #12
adamps commentedGreat thanks and it's a good idea to add a test. Do we really need a whole new test file though?
Comment #13
berdirI'd like to check why this doesn't fail in the existing tests, will do that asap.
Comment #14
adamps commentedThanks @Berdir. We do already get an exception (but not fail) for the duplicate status key. We don't get any exception that I can see for the has_title.
Comment #15
berdirYeah, this apparently can't be tested, the test above is also not failing.
The reason is that config entity config is passed through the entity and back and in that process, top-level keys that not on the annotation are silently dropped and then the config schema validation happens on save and then it is gone. The settings key is also bogus and doesn't exist anymore.
Here's a patch with just removals.
Core does test for this, with \Drupal\KernelTests\Config\DefaultConfigTest, by installing config and then comparing if it was altered, but I think that's a bit overkill.
The status is something else entirely, that's the symfony YAML parser that does a deprecation message on that.
Comment #17
adamps commentedGreat thanks @Berdir and everyone else