- Issue created by @steven jones
- acee31b1 committed on 8.x-1.x
Issue #3503989: Config schema references incorrect properties
- acee31b1 committed on 8.x-1.x
- πΊπ¦Ukraine goodboy Kharkiv, Ukraine
@steven jones, thank you for your report.
- π¬π§United Kingdom steven jones
Woah! https://git.drupalcode.org/project/advban/-/commit/acee31b11c1aa9be5dc39... is going to break all existing installs, if you want to rename your config keys like that you're going to need to provide a migration path for existing installs.
I'd was advocating for changing the contents of advban.schema.yml to match the existing names.
- 21926211 committed on 8.x-1.x
Issue #3503989: Config schema references incorrect properties
- 21926211 committed on 8.x-1.x
- πΊπ¦Ukraine goodboy Kharkiv, Ukraine
@steven jones, I changed the schema. Please, review
- π¬π§United Kingdom steven jones
@goodboy the naming looks better, thanks. Looks like the type of the
expiry_durations
property isn't correct, I think it should be 'string' not a 'text' because it's not translateable? - πΊπ¦Ukraine goodboy Kharkiv, Ukraine
@steven jones, I use "text" because the expiration date can potentially be longer than 255 characters.
- π¬π§United Kingdom steven jones
@goodboy I don't think the 'string' type imposes a length limit, though might be wrong about that! What makes you think it has a length limit?
- πΊπ¦Ukraine goodboy Kharkiv, Ukraine
@steven_jones, I use '#type' => 'textfield' and '#type' => 'textarea' for form fields and correspond them to schema fields as 'textfield' => 'string', 'textarea' => 'text'. The textfield type has limitation 255 chars.
I consider the expiry_durations field like a description and I found core schemas use 'text' type for descriptions. So, I think the field can be left 'text' type. Perhaps the type 'string' can also be used but I prefer don't change anything if I can.
I also asked AI for differences between 'string' and 'text' schema types.
"In Drupal, both string and text are data types used for storing textual data, but they serve different purposes and have distinct characteristics. Here's a breakdown of the differences:
1. string Type
Purpose: Used for short, simple text values.
Storage: Typically stored in the database as a VARCHAR with a limited length (e.g., 255 characters by default in Drupal).
2. text Type
Purpose: Used for longer, more complex text values that may include formatting or multiple lines.
Storage: Stored in the database as a TEXT field, which can hold much larger amounts of data compared to VARCHAR."Honestly, I don't know how right this is. But I think something like that.
- π¬π§United Kingdom steven jones
Thanks for your response, but I think you've managed to research the Database Schema, rather than the Config Schema I think?
I searched for a relevant example in Drupal core, and I think the most comparable thing to a big lump of text is the request path condition plugin in the block system, i.e. this:
The config schema for that plugin is this:
condition.plugin.request_path: type: condition.plugin mapping: pages: type: string
I.e. a
string
, like I'm suggesting you should use too.The main trait of the
text
type is that it specifies that the content is translatable, which is weird for this use-case.So, I think it should be
string
.In theory, if you wanted to change the data model, then you could store the data as an array of durations, rather than a string that gets exploded/imploded etc. but that's probably another issue :)
- 9db141e3 committed on 8.x-1.x
Issue #3503989: Config schema references incorrect properties
- 9db141e3 committed on 8.x-1.x
- πΊπ¦Ukraine goodboy Kharkiv, Ukraine
@steven jones, I have changed the type of the field, as you said. Thank you
- π¬π§United Kingdom steven jones
Thanks, the config schema issues raised in my original OP have been sorted.
Automatically closed - issue fixed for 2 weeks with no activity.