- Issue created by @phenaproxima
- Merge request !6617Mark non-extending types as validatable and see what breaks β (Closed) created by phenaproxima
- Status changed to Needs review
9 months ago 2:06pm 15 February 2024 - πΊπΈUnited States phenaproxima Massachusetts
No breaks! I think this is ready for a review.
- Status changed to Needs work
9 months ago 10:03am 16 February 2024 - π§πͺBelgium borisson_ Mechelen, π§πͺ
I'm not sure I agree with wim's remark, it would lead to this same documentation being on all of those instances. I actually think this is rtbc.
I'm not sure how to set the status for this issue now.
- Status changed to Needs review
8 months ago 2:42pm 8 March 2024 - Status changed to RTBC
8 months ago 3:23pm 8 March 2024 - Merge request !6978Alternative approach: mark the two fallback types `field.storage_settings.*`... β (Closed) created by wim leers
- Status changed to Needs work
8 months ago 5:28pm 8 March 2024 - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
RTBC +1. I like this!
However, I see a few that have been overlooked:
field.storage_settings.daterange
field.field_settings.daterange
field.storage_settings.text_long
field.formatter.settings.text_default
So β¦ un-RTBC'd π
(Found these using the regex
field.field_settings.[a-z]+\:\n type:
in PHPStorm.)But playing devil's advocate, we could delete all of these config schema types (
field.field_settings.string:
and instead dofield.storage_settings.*: type: mapping label: 'Settings' # By default, a field type has no settings, so this can safely be considered # fully validatable. A `FOO` field type that has one or more settings is # required to create a `field.storage_settings.FOO` config schema type, and # cannot possibly forget to do that, because validation errors would be # triggered if it ever tried to save a setting, since this mapping allows no # key-value pairs at all. constraints: FullyValidatable: ~ field.field_settings.*: type: mapping label: 'Settings' # By default, a field type has no settings, so this can safely be considered # fully validatable. A `FOO` field type that has one or more settings is # required to create a `field.field_settings.FOO` config schema type, and # cannot possibly forget to do that, because validation errors would be # triggered if it ever tried to save a setting, since this mapping allows no # key-value pairs at all. constraints: FullyValidatable: ~
and then simply delete all of the ones that define no settings at all. AFAICT that should work too? π€ And would reduce the total number of types, keep things simpler? Created alternative MR to try that, curious about the test results π
- Status changed to Needs review
8 months ago 7:01pm 8 March 2024 - πΊπΈUnited States phenaproxima Massachusetts
field.storage_settings.daterange
field.field_settings.daterange
field.storage_settings.text_long
field.formatter.settings.text_defaultDid the first three. The last one is out of scope; this issue is only handling field.field_settings.* and field.storage_settings.*.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Looks like I made some mistakes in my alternative MR π
But what do you think about the concept?
- πΊπΈUnited States phenaproxima Massachusetts
I do kind of like the concept. I dig the idea that someone defining a new field type without additional settings can be guaranteed, with no additional effort, that they are conformant to config schema (which, as I've said elsewhere, is quite an arcane topic).
As long as we could reliably inform developers that, the moment they add settings that are stored in config, they need to define a schema type with constraints for it...
I feel like your concept, while a good idea, is best suited to a follow-up. Unless it's a relatively easy lift to get it working in your MR.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Unless it's a relatively easy lift to get it working in your MR.
I'm 90% confident that I just fixed my silly mistakes.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Green! π
- Original MR:
6 files, +72, -0
- Alternative MR:
6 files, +46, -71
- Original MR:
- Status changed to Needs work
8 months ago 7:56pm 11 March 2024 - πΊπΈUnited States phenaproxima Massachusetts
I like your way better! It's simpler and more future proof. Closed mine out. We'll need an issue summary update here...
- Status changed to Needs review
8 months ago 9:56pm 11 March 2024 - Status changed to RTBC
8 months ago 1:15pm 12 March 2024 - πΊπΈUnited States phenaproxima Massachusetts
Do we need a change record here? I'm not sure if config schema is really considered API, as such.
I'll assume we don't and just go ahead and RTBC this. I have no complaints about the MR.
- π§πͺBelgium borisson_ Mechelen, π§πͺ
I think we've had change records for a lot of other mark x as fully validatable issues recently, but I'm not sure if we actually need that.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
We've only had CRs for:
- new config schema types, because these are new APIs (this doesn't do that)
- new/modified validation constraints, because these are new/expanded APIs (this doesn't do that either)
- config entity types that become fully validatable AND have config schema changes in the process (nope, this isn't happening here either)
So in this case, there's literally ZERO API impact, so there's also no need for this. π
- Status changed to Needs review
8 months ago 12:31pm 13 March 2024 - π¬π§United Kingdom longwave UK
field.storage_settings.password: type: field.storage_settings.string label: 'Password settings'
This has no settings so could be removed too?
- Assigned to wim leers
- Status changed to Needs work
8 months ago 12:59pm 13 March 2024 - πΊπΈUnited States phenaproxima Massachusetts
I'm guessing so. Assigning to Wim for that, then I'll re-RTBC.
- Assigned to longwave
- Status changed to RTBC
8 months ago 3:20pm 13 March 2024 - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
This has no settings so could be removed too?
No, because of:
type: field.storage_settings.string
which looks like this:
field.storage_settings.string: type: mapping label: 'String settings' mapping: max_length: type: integer label: 'Maximum length' case_sensitive: type: boolean label: 'Case sensitive' is_ascii: type: boolean label: 'Contains US ASCII characters only'
I actually made the very same mistake π And that resulted in test failures:
Drupal\KernelTests\Core\Field\FieldType\PasswordItemTest::testPreSavePreHashed Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for field.storage.entity_test.test_field with the following errors: field.storage.entity_test.test_field:settings.max_length missing schema, field.storage.entity_test.test_field:settings.is_ascii missing schema, field.storage.entity_test.test_field:settings.case_sensitive missing schema, 0 [settings] 'max_length' is an unknown key because type is password (see config schema type field.storage_settings.*)., 1 [settings] 'is_ascii' is an unknown key because type is password (see config schema type field.storage_settings.*)., 2 [settings] 'case_sensitive' is an unknown key because type is password (see config schema type field.storage_settings.*).
Whic is why I had to revert my overly eager simplifications π
- Issue was unassigned.
- Status changed to Fixed
8 months ago 3:38pm 13 March 2024 - π¬π§United Kingdom longwave UK
OK, that makes sense! I didn't find any other issues when reviewing.
Committed and pushed 7e2b0d453c to 11.x and 8dd90d73a0 to 10.3.x. Thanks!
-
longwave β
committed 8dd90d73 on 10.3.x
Issue #3421626 by phenaproxima, Wim Leers, borisson_: Mark config schema...
-
longwave β
committed 8dd90d73 on 10.3.x
-
longwave β
committed 7e2b0d45 on 11.x
Issue #3421626 by phenaproxima, Wim Leers, borisson_: Mark config schema...
-
longwave β
committed 7e2b0d45 on 11.x
Automatically closed - issue fixed for 2 weeks with no activity.