3

My module is working as expected with the following settings, config and config export. But when I try to run tests, I get the following error. I'm not sure what is wrong.

Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for riddler.settings with the following errors: riddler.settings:riddles missing schema in Drupal\Core\Config\Testing\ConfigSchemaChecker->onConfigSave() (line 102 of /var/www/sb/sboss/docroot/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php).

# settings.yml
riddles:
 -
    question: 'Do you really hate Spam?'
    response: 'Yes!'
langcode: en


--------------------------------


#schema
riddler.settings:
  type: config_object
  riddles:
      question:
        type: label
        label: 'Question'
      response:
        type: label
        label: 'Response'


#config export

riddles:
 -
    question: 'Do you really hate Spam?'
    response: Yes!
  -
    question: 'What''s your favorite primary color?'
    response: 'blue, yellow, red'
1

I see several errors, not sure which one trips you: you missed a type for riddles and tried to define a mapping immediately under. But riddles is a sequence and each element in the sequence is that mapping. So:

riddler.settings:
  type: config_object
  mapping:
    riddles:
      type: sequence
      sequence:
        type: mapping
          question:
            type: label
            label: 'Question'
          response:
            type: label
            label: 'Response'

At least that's what I would attempt...

0
1

Here's what worked.

riddler.settings:
  type: config_object
  mapping:
    riddles:
      type: sequence
      sequence:
        type: mapping
        mapping:
          question:
            type: label
            label: 'Question'
          response:
            type: label
            label: 'Response'

Thanks to chx for getting this most of the way there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.