Replace useless ui-patterns:// references

Created on 2 October 2024, about 1 month ago

Problem/Motivation

The migration drush command from ui_patterns_legacy is currently putting a reference at every prop.

Example:

props:
  type: object
  properties:
    active:
      title: "Active?"
      description: "It is possible to set button as active?"
      $ref: "ui-patterns://boolean"
    size:
      title: Size
      description: "It is possible to set the size of buttons."
      $ref: "ui-patterns://enum"
      enum:
        - xs
        - sm
        - md
        - lg
      "meta:enum":
        xs: "Extra small"
        sm: Small
        md: Medium
        lg: Large
    url:
      title: URL
      description: "The button URL. Optional."
      $ref: "ui-patterns://url"

https://git.drupalcode.org/project/ui_suite_daisyui/-/blob/4.0.x/compone...

However, some references provide the same schema as a simple JSON type:

  • $ref: "ui-patterns://boolean" is the same as type: boolean according to
    BooleanPropType
  • $ref: "ui-patterns://string" is the same as type: string according to StringPropType

We will update the drush command to put the JSON type instead of the references, but ui_suite_daisyui was already migrated.

Proposed resolution

Replace all $ref: "ui-patterns://boolean" by type: boolean.

Replace all $ref: "ui-patterns://string" by type: string

Also, we need to try it before, but all $ref: "ui-patterns://number" could be replaced by type: number or type: inetger according to the context.

πŸ“Œ Task
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡«πŸ‡·France pdureau Paris

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

Comments & Activities

Production build 0.71.5 2024