Problem/Motivation

At #3082312: No configuration schema the configuration schema was added, the problem is that the configuration saved is different than what the schema expets:

Schema:

registration_role.setting:
  type: config_object
  label: 'Registration role settings'
  mapping:
    role_to_select:
      type: sequence
      label: 'User roles'
      sequence:
        type: string
        label: 'Role'
    registration_mode:
      type: string
      label: 'Registration mode'

And the configuration that is saved is something like this:

  role_to_select:
     role1: role1
     role2: 0
     role3: 0  
  registration_mode: 'user'

This breaks the `role_to_select` because it expects a string and some values (the unselected ones) are 0.

This in particular breaks when a test is run that depends on this module:
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for registration_role.setting with the following errors: registration_role.setting:role_to_select.role1 variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData,

Proposed resolution

Make the configuration match with the schema, removing the roles that are unselected from the configuration (right now are saved as 0)

CommentFileSizeAuthor
#3 3155688-3.patch1.88 KBgnuget

Comments

gnuget created an issue. See original summary.

gnuget’s picture

Issue summary: View changes
gnuget’s picture

Status: Active » Needs review
StatusFileSize
new1.88 KB

Patch attached.

mlncn’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

  • mlncn committed 5939b29 on 8.x-1.x authored by gnuget
    Issue #3155688 by gnuget, mlncn: Configuration schema does not match...
mlncn’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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