Is 'id' a reserved key in properties?

Created on 7 December 2024, 7 months ago

Problem/Motivation

Following the guide in https://www.drupal.org/docs/develop/theming-drupal/using-single-director... β†’

name: My Component
status: stable
group: Molecule/My Component
props:
  type: object
  properties:
    id:
      type: string
      title: Uh oh...

PHPstorm's intellisense reports Schema validation: Incompatible types. Required: string. Actual: object..

Changing the id property to any other string makes it happy. Is id a reserved / special identifier under props, or is PHPStorm just bugging out? πŸ€”

Steps to reproduce

On PHPStorm 2024.2.3, add this SDC.

$schema: 'https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json'
name: Accordion
status: stable
group: Molecule/Accordion
description: An accordion component
props:
  type: object
  properties:
    id:
      type: string
      title: Accordion content ID

and see these squiggles...

Proposed resolution

Add documentation about if ID is reserved...or maybe guidance on how to make phpstorm behave better?

User interface changes

Maybe new docs?

API changes

None

Data model changes

None

πŸ’¬ Support request
Status

Active

Version

11.1 πŸ”₯

Component

single-directory components

Created by

πŸ‡ΊπŸ‡ΈUnited States luke.leber Pennsylvania

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

Comments & Activities

  • Issue created by @luke.leber
  • Status changed to Closed: works as designed 5 days ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    @luke.leber, as you can see by the lack of response the Drupal Core issue queue is not the ideal place for support requests. The 'support request' option is there for filing support issues for contributed modules and themes. There are several support options listed on our Support page β†’ , including the Drupal Forums β†’ and Drupal Answers. I suggest you seek an answer in one of those places.

Production build 0.71.5 2024