Problem/Motivation
See #3382581-16: Add new `EntityBundleExists` constraint, -18 and -19:
While "gracefully returning" sounds good, it also means that the developer who writes a typo like
EntityBundleExists: '%paren.target_entity_type_id', they get no feedback!
Because if we don't, we could probably throw an error and tell people something like: %paren found in resolved schema, there is a typo in your schema definition..
Steps to reproduce
Create a config schema definition with a typo in it. Note the absence of a useful error, making for a very painful DX.
Proposed resolution
Add helpful error message! Improved DX 🚀
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3392903-2.patch | 2.52 KB | borisson_ |
| #5 | interdiff.txt | 2.48 KB | borisson_ |
| #3 | 3392903.patch | 2.52 KB | borisson_ |
Issue fork drupal-3392903
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:
- 3392903-validate-inputs-resolveexpression
changes, plain diff MR !6404
Comments
Comment #2
wim leersComment #3
borisson_Implementation discussed with @Wim Leers yesterday. Patch builds on top of 3382581
Comment #4
wim leerss/null/NULL/
\Drupal\Core\Config\TypedConfigManager::replaceVariable()calls these variable values, we should probably do the same here.Typos 😅
Comment #5
borisson_Comment #6
borisson_Was looking at the configuration validation issues, and noticed this should actually be marked as postponed, changing status to match the reality.
Comment #7
wim leersThis would complement #3406487: Consistently use "dynamic type name" and "expression" instead of "variable value" in TypedConfigManager's terminology very well.
Comment #8
wim leers#3406487: Consistently use "dynamic type name" and "expression" instead of "variable value" in TypedConfigManager's terminology landed!
@borisson_: Could we add a secondary MR here that does not modify
TypeResolver(which does not exist yet, which is why this issue is postponed), but instead modifiesTypedConfigManager? We'd have to rebase theEntityBundleExistsMR that this is blocked on, but we probably need to rebase it anyway at this point.Comment #9
wim leers#3382581: Add new `EntityBundleExists` constraint landed so this is now unblocked!
Comment #11
wim leersTransformed #5 into a MR. Now reviewing 🤓
Comment #12
wim leersComment #13
wim leersFWIW, this is becoming more important, because other issues are starting to adopt
TypeResolvertoo — for example #3324140: Convert field_storage_config and field_config's form validation logic to validation constraints.Comment #14
borisson_Fixed the remarks from @Wim Leers. I had to update one existing test: https://git.drupalcode.org/project/drupal/-/merge_requests/6404/diffs?co...
Comment #15
wim leersLooking close, two small pieces of feedback 😊
Comment #16
borisson_Fixed the first (variable value) remark, the other one is a bit harder to figure out. It's part of the test coverage we created for #3382581: Add new `EntityBundleExists` constraint, not for this issue.
I don't know how to add the requested test coverage.
Comment #17
wim leers@borisson_ You'll want to modify the test logic to not just mock a parent level, but a grandparent level. That way you'd be able to at least test
%parent.%parent.entity_type_id, and then there's >1 test case again :)Comment #18
borisson_Fixed the feedback, rerolled on 11.x and added test coverage for %key. I think this is now ready for another round of reviews.
Comment #19
borisson_Comment #20
wim leersComment #21
borisson_Hopefully resolved the new comments.
Comment #22
wim leersWas going to RTBC, then spotted one last small problem. 🫣
Updated the issue summary for you :)
Comment #23
borisson_Applied Wim's latest suggestion, it is indeed more clear like this.
Comment #24
wim leersComment #26
alexpottCommitted and pushed 94e4d4715c to 11.x and fce65ce3aa to 10.3.x. Thanks!