String props that are integer values aren't treated as strings

Created on 4 September 2024, 15 days ago
Updated 13 September 2024, 6 days ago

Overview

This is a minor thing and not a blocker as it can be worked around.

If you have a prop like:

     level:
       type: string
       title: Level
       description: 'Semantic level: 1, 2, 3, 4, 5, 6.'
       default: '2'
       enum:
        - '1'
        - '2'
        - '3'
        - '4'
        - '5'
        - '6'
       examples:
        - '2'

then you get this error when trying to change the prop in the sidebar prop form:

Drupal\Core\Render\Component\Exception\InvalidComponentException: [level] Integer value found, but a string or an object is required/n[level] Does not have a value in the enumeration ["1","2","3","4","5","6"] in Drupal\Core\Theme\Component\ComponentValidator->validateProps() (line 203 of /var/www/html/web/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php).

Proposed resolution

Decide if we should allow integers masquerading as strings. If so, handle accordingly.

User interface changes

Sidebar form will let you change the prop value.

šŸ› Bug report
Status

Closed: duplicate

Component

Page builder

Created by

šŸ‡ŗšŸ‡øUnited States Kristen Pol Santa Cruz, CA, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024