I am receiving the following issue when attempting to run a browser test installing the configuration of the r4032login module.

Schema errors for r4032login.settings with the following errors: r4032login.settings:access_denied_message_type variable type is string but applied schema class is Drupal\Core\Config\Schema\Mapping, r4032login.settings:default_redirect_code variable type is string but applied schema class is Drupal\Core\Config\Schema\Mapping, r4032login.settings:_core missing schema, r4032login.settings:langcode missing schema
 /....../web/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php:93
 /....../web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php:111
  /....../web/core/lib/Drupal/Core/Config/Config.php:227
  /....../web/core/lib/Drupal/Core/Config/ConfigInstaller.php:325

The issue seems to be caused by the settings schema. I spotted three issues there:

  • The access_denied_message_type property is defined as
    access_denied_message_type:
          type: mapping
          label: "User login 'access denied' message type"
          mapping:
            error:
              type: string
              label: 'Error'
            warning:
              type: string
              label: 'Warning'
            status:
              type: string
              label: 'Status'
    

    and in the r4032.settings.yml file it is defined as

    access_denied_message_type: 'error'
    

    while, if we follow the mapping above, it would be

    access_denied_message_type: 
        error:error
    

    The type should change to string. The value is assured by the options field in the admin settings form. Further validation can be set but I do not think this is that necessary.

  • The access_denied_message_type property is defined as
    default_redirect_code:
          type: mapping
          label: 'HTTP redirect code'
          mapping:
            302:
              type: integer
              label: '302 Found'
            301:
              type: integer
              label: '301 Moved Permanently'
    

    and in the r4032.settings.yml file it is defined as

    default_redirect_code: '302'
    

    while, if we follow the mapping above, it would be

    default_redirect_code: 
        302: 302
    
  • The r4032login schema itself is defined as
    r4032login.settings:
      type: mapping
      label: 'Redirect 403 to User Login (r4032login) settings'
    

    This is because it is expecting a config_hash.
    The settings should be defined as type 'config_object'.

Proposed solution

  • The access_denied_message_type type should change to string. The value is assured by the options field in the admin settings form. Further validation can be set but I do not think this is that necessary.
  • The default_redirect_code should change to integer. The value is assured by the options field in the admin settings form. Further validation can be set but I do not think this is that necessary.
    A caution here: I do not know if that will cause any issues on updates since the value in r4032login.settings.yml was '302' which is a string but should be 302 which is an integer.
  • Change the settings schema to be of type 'config_object' as it normally should be.
CommentFileSizeAuthor
#2 schema_fix-2833695-2-D8.patch1.9 KBidimopoulos
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idimopoulos created an issue. See original summary.

idimopoulos’s picture

I am submitting a patch to assure the proper schema.

idimopoulos’s picture

Status: Active » Needs review

Setting to needs review.

claudiu.cristea’s picture

Status: Needs review » Reviewed & tested by the community

Perfect!

pfrenssen’s picture

+1

  • bdone committed 391f10d on 8.x-1.x authored by idimopoulos
    Issue #2833695 by idimopoulos: Errors with schema and installed settings...
bdone’s picture

Status: Reviewed & tested by the community » Fixed

committed, thanks!

Status: Fixed » Closed (fixed)

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