Dec 12, 2015

Drupal 8, Beta 14 --> Beta 15: Missing langcode in configuration schema

In migrating from Drupal 8 beta 14 to beta 15, the functionality of the module itself worked fine, but some of the automated tests were failing with error messages that included the following.
Uncaught PHP Exception Drupal\Core\Config\Schema\SchemaIncompleteException: "Schema errors for optimizely.settings with the following errors: optimizely.settings:langcode missing schema" at /var/www/html/opti/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php line 98
In this message, optimizely.settings is the name of a group of configuration settings. It is also a configuration key in a .schema.yml file that is required for automated testing, which I blogged about earlier at Beta 3 --> Beta 4:  Configuration schema and metadata.

The article Fix config schema mentioned a very similar error message and stated "Because of a recent core change all tests are failing". I looked at the patches in that article, but I could not figure out what needed to be added in our case.

Then a search through the core code for the string "langcode:" led me to add langcode: as a key to the .schema.yml file as in the following.

  type: mapping
  label: 'Optimizely Config Data'
      type: integer
      label: 'Optimizely ID Number'
      translatable: false
      type: string
      label: 'Language code'

Problem solved. All automated tests passed after this change.

Update:  Also see my later post on  Module: Configuration Inspector for Drupal 8.


Beta 3 --> Beta 4: Configuration schema and metadata

Fix config schema

All TestBase derived tests now enforce strict configuration schema adherence by default

Configuration schema/metadata

1 comment:

  1. Interesting! This seems to be at the root of the localization efforts in D8. I'd love to more of your thoughts on this as it seems like an important issue for any schema design where language has become a basic consideration.