Problem/Motivation

Prop types have JSON schemas, example:

#[PropType(
  id: 'enum',
  label: new TranslatableMarkup('Enum'),
  default_source: 'select',
  schema: ['type' => ['string', 'number', 'integer'], 'enum' => []],
  typed_data: ['float', 'integer', 'string'],
)]

Today, they have 2 distinct usages:

  • as syntax shortcut for component authors thanks to the ui-patterns:// stream wrapper in JSON schema references
  • used by the CompatibilityChecker to guess which prop has which type

We have 2 problems here:

Proposed resolution

  • Create a schema.json file at the root of the module with the schema of all our prop types
  • Update our codes and our tests to use module://ui_patterns/schema.json#foo instead of ui-patterns://foo
  • Add a drush command to convert existing SDC files
  • Deprecate Drupal\ui_patterns\SchemaManager\StreamWrapper. It will be removed in UI Patterns 3.0.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Issue summary: View changes

pdureau’s picture

Assigned: Unassigned » pdureau
Status: Active » Needs work

Work in progress. Some phpunit errors to fix:

  • Drupal\Core\Render\Component\Exception\InvalidComponentException: The component "ui_patterns_test:ui-component" uses non-string types for properties: attributes.
  • Exception: Warning: Undefined array key "type". Drupal\Core\Theme\Component\ComponentValidator->Drupal\Core\Theme\Component\{closure}()() (Line: 98)

And 4 failures in Drupal\Tests\ui_patterns\Kernel\SchemaManagerTest::testResolve

Once mergeable, let's discuss about the strategy before committing. This MR will not be comaptible with Drupal 10.x, 11.0, 11.1 & 11.2.
Do we need to also add Drupal 11.3's stream wrapper? Or do we need to wait UI Patterns 2.1 (the version getting rid of 10.x compatibility)

pdureau’s picture

Assigned: pdureau » Unassigned
Status: Needs work » Needs review

Pipeline fails bu the same tests are OK on my local environment, so it is the time for a first review and to open the discusssion.

Let's discuss about the strategy before committing. This MR will not be compatible with Drupal 10.x, 11.0, 11.1 & 11.2.

  • Do we add a copy of Drupal 11.3's stream wrapper in our own codebase?
  • Or do we wait UI Patterns 2.1 (the version getting rid of 10.x compatibility)?
grimreaper’s picture

Migration command tested on #3586282: Adopt Core's stream wrapper: OK

grimreaper’s picture

Issue tags: +DevDaysAthens2026
pdureau’s picture

Assigned: Unassigned » pdureau
Status: Needs review » Needs work

Let's discuss about the strategy before committing. This MR will not be compatible with Drupal 10.x, 11.0, 11.1 & 11.2.

  • Do we add a copy of Drupal 11.3's stream wrapper in our own codebase?
  • Or do we wait UI Patterns 2.1 (the version getting rid of 10.x compatibility)?

We do both:

  • in 2.0.x branch, we copy the class from Core to stay compatible
  • in 2.x branch (for the upcoming 2.1.x, 2.2.x, 2.3x... tags), we don't because it will be Drupal 11.3 minimum

All new features will only land in 2.x branch, only bugfixes will be backported to 2.0.x

pdureau’s picture

Assigned: pdureau » christian.wiedemann
Status: Needs work » Needs review

Pipeline has phpunit fails i don't have at home.

The 4 tests of Drupal\Tests\ui_patterns\Kernel\SchemaManagerTest::testResolve are KO:

 Array (
-    'type' => [...]
+    '$ref' => 'module://ui_patterns/schema.json#enum'
 )

The reference resolution is not done.

Can you try in your environment?