aInvestigate if ComponentValidator should have soft dependency on justinrainbow/json-schema

Created on 4 October 2024, 4 months ago

Problem/Motivation

In the parent issue πŸ“Œ Move JSON:API validation to a feature flag or separate module Active we put schema validation for jsonapi behind a feature flag. ComponentValidation does the same. We should investigate if this leads to performance issues the same as with jsonapi.

Drupal\Core\Theme\Component\ComponentValidator

That kinda does the same.

  /**
   * Sets the validator service if available.
   */
  public function setValidator(?Validator $validator = NULL): void {
    if ($validator) {
      $this->validator = $validator;
      return;
    }
    if (class_exists(Validator::class)) {
      $this->validator = new Validator();
    }
  }

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

theme system

Created by

πŸ‡³πŸ‡±Netherlands bbrala Netherlands

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

Comments & Activities

  • Issue created by @bbrala
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands
  • πŸ‡ΊπŸ‡ΈUnited States neeks

    Does composer autoload its own dependencies? When I run composer why justinrainbow/json-schema it outputs:

    composer/composer   2.8.4  requires justinrainbow/json-schema (^5.3) 
    drupal/core-dev     10.4.0 requires justinrainbow/json-schema (^5.2) 
    

    Sidebar: I found my way here after spending all day trying to figure out why my theme's custom link utility component kept throwing errors over the attributes object prop I had defined with messages like [attributes] String value found, but an object is required. Another attributes property was always getting set regardless of using `only` to try and control context.

    I ended up just deleting the custom prop definition, but that felt like it kind of defeated the whole point of a schema. Validation needs to be optional or "looser"

Production build 0.71.5 2024