Problem/Motivation

The configuration schema declares the sections option of the Bootstrap Accordion with an invalid data type:

https://git.drupalcode.org/project/views_bootstrap/-/blob/5.5.2/config/s...

  views.style.views_bootstrap_accordion:
  ...
    sections:
      type: array
      label: "Open Elements"
      items:
        type: string
      default: []

array is not a Drupal configuration schema data type, and items / default are not part of the configuration schema language (they belong to JSON Schema). Drupal only knows the primitive types plus mapping and sequence.

As a result, TypedConfigManager::determineType() cannot resolve the type and falls back to undefined, so the element is an Undefined object and SchemaCheckTrait::checkValue() reports missing schema for that key.

Steps to reproduce

  1. Install Drupal 10.1+/11 and Views Bootstrap 5 (5.5.2); enable views_bootstrap, views_ui.
  2. Create a view with a page or block display, set Format to Bootstrap Accordion, select a Panel title field and save the view.
  3. Export the configuration (drush config:export) and confirm the display options contain a sections key.
  4. Install the Configuration Inspector module and visit /admin/config/development/configuration/inspect, or run drush config-inspector:inspect views.view.YOUR_VIEW. The view is listed with errors and the detail is:
    views.view.YOUR_VIEW:display.default.display_options.style.options.sections missing schema
  5. Re-import the configuration (drush config:import): the same schema validation warnings are raised for every configuration object that uses this style.
  6. Alternatively, in a kernel test with protected $strictConfigSchema = TRUE; (the default), save a view using the Bootstrap Accordion style: the test fails with SchemaIncompleteException.

Proposed resolution

Fix the schema definition in config/schema/views_bootstrap.style.schema.yml so that the sections option uses a valid Drupal configuration schema type. The attached patch:

  • replaces type: array with type: sequence, the correct type for a list of values in Drupal configuration schema;
  • replaces the items: key with the required sequence: key, keeping type: string for the items;
  • removes default: [], which has no meaning in configuration schema — the default already belongs to the style plugin, which declares $options['sections'] = ['default' => []] in ViewsBootstrapAccordion::defineOptions().
sections:
  type: sequence
  label: "Open Elements"
  sequence:
    type: string

With this change the key resolves to a Sequence of strings. A sequence accepts string keys (core itself does this, e.g. core.extension:module), so the values produced by the checkboxes element (first, middle, last) remain valid, and the unchecked value 0 as well as the checked value (the option key) are both covered by string.
The missing schema errors disappear, the values are properly cast on save/export, and no PHP code change or update path is required.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

No change to the stored configuration structure: the sections key and its first / middle / last entries are unchanged. Only the schema definition changes, so the values are now typed and cast as strings (for example 0 becomes '0') the next time the view is saved or exported. Existing configuration remains valid and no update path is required.

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

lolgm created an issue. See original summary.

lolgm changed the visibility of the branch 5.5.x to hidden.

lolgm’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new531 bytes

MR !64 implements the proposed solution in this issue.

  • shelane committed 56c4860d on 5.5.x authored by lolgm
    fix: #3614624 Invalid config schema for the Accordion
    
shelane’s picture

Status: Needs review » Fixed

Thanks

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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