Problem/Motivation

Discovered in #3364109: Configuration schema & required values: add test coverage for `nullable: true` validation support.

For example:

1) Drupal\Tests\node\Kernel\NodeTypeValidationTest::testEntityIsValid
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for node.type.kddiqdxr with the following errors: 0 [description] This value should not be null., 1 [help] This value should not be null.

Steps to reproduce

Run Drupal core's test suite with #3364109: Configuration schema & required values: add test coverage for `nullable: true` validation support applied, and with the lines

    'node.type.*' => [
      // @todo Fix config or tweak schema of `type: node.type.*`.
      // @see node.schema.yml
      'name' => [
        'This value should not be null.',
      ],
      'description' => [
        'This value should not be null.',
      ],
      'help' => [
        'This value should not be null.',
      ],
    ],

removed from \Drupal\Core\Config\Schema\SchemaCheckTrait::checkConfigSchema().

Proposed resolution

Solution:

name
Every config entity type may have a listing, so labels are essential. All node type config entities that do not have a label are currently not usable in the admin UI.
description
Either:
  1. add description: '' to every single node.type.*.yml file and 'description' => '', to every single NodeType::create(…) call
  2. or update \Drupal\block\Entity\NodeType::$description to default to ''.
  • or update node.schema.yml to allow description. to be null: add nullable: true (because it seems like it really should be optional and then the empty string makes no sense).
    provider … but this would be a BC break for \Drupal\node\NodeTypeInterface::getDescription() whose API docs claim it always returns a string.
    help
    Same exact possible choices as for description.

    ⚠️ … but also wait for the remainder of node.type.* to become validatable? The following property paths are not yet validatable at this time:

    1. preview_mode → happening in #3379091: Make NodeType config entities fully validatable 👍

    Remaining tasks

    Fix all of these failures.

    User interface changes

    None.

    API changes

    None.

    Data model changes

    None.

    Release notes snippet

    N/A

  • Comments

    Wim Leers created an issue. See original summary.

    wim leers’s picture

    Issue summary: View changes
    Status: Active » Postponed

    I missed that preview_mode is not yet validatable.

    wim leers’s picture

    Title: Fix NodeType config entity type config schema violations: name, description, help » [PP-1] Fix NodeType config entity type config schema violations: name, description, help
    Issue summary: View changes
    Related issues: +#3379091: Make NodeType config entities fully validatable
    wim leers’s picture

    Title: [PP-1] Fix NodeType config entity type config schema violations: name, description, help » [PP-2] Fix NodeType config entity type config schema violations: name, description, help

    #3379091: Make NodeType config entities fully validatable itself is now postponed, so increasing blockedness.

    wim leers’s picture

    Title: [PP-2] Fix NodeType config entity type config schema violations: name, description, help » Fix NodeType config entity type config schema violations: name, description, help
    Status: Postponed » Closed (outdated)