Problem/Motivation

Such component may breaks:

name: Test
props:
  type: object
  properties:
    foo:
      type: object
      properties:
        id:
          type: string

Because in ReferencesResolver service, we run recursively run justinrainbow resolver which

  • is transforming every arrays to StdClass, included nested arrays
  • add a id property when a reference is solved to keep track of the resolution

And then we do some operations on this added id property, whcih fail when we are manipulating the prop named id instead.

Proposed resolution

  • Minimal: alter the id property only if a reference has been resolved
  • Better: run the justinrainbow resolver only there is a $ref property.
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

yuraul made their first commit to this issue’s fork.

pdureau’s picture

Assigned: pdureau » Unassigned

hi @yuraul feel free to assign the issue to you.

smovs’s picture

Assigned: Unassigned » smovs

smovs changed the visibility of the branch 3612960-props-named-id to hidden.

smovs changed the visibility of the branch 3612960-props-named-id to active.

smovs’s picture

Assigned: smovs » Unassigned
Status: Active » Needs review

Hey @pdureau and team!
I pulled the latest 2.0.x branch and updated the approach a bit. Please review

pdureau’s picture

Assigned: Unassigned » pdureau

Thanks a lot, i will have a look

pdureau’s picture

That looks great, bu tI will also test it with #3352063: Allow schema references in Single Directory Component prop schemas before RTBC

pdureau’s picture

Assigned: pdureau » just_like_good_vibes
Status: Needs review » Reviewed & tested by the community

This issue seems to not exist in the Core MR: #3352063: Allow schema references in Single Directory Component prop schemas.

So, the logic added here will be removed once we adopt the Core reference resolver in 2.1.x or 3.x releases. But we at least we will have the added tests to prevent any regression.

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » smovs
Status: Reviewed & tested by the community » Needs work

hello :)
thanks for the nice work,
just before we go on with this MR, is-it possible to shrink the long comments please ? ( co-edited by Claude?)
thank you

smovs’s picture

Assigned: smovs » just_like_good_vibes
Status: Needs work » Needs review

Hi!
Updated comments. Simplified and removed redundancy.
Yes, I used Claude (a really helpful tool)

just_like_good_vibes’s picture

hello, i tried to rebase the work, but i finally created a second branch up to date with the last 2.0.x and integrated your work in it.
i opened https://git.drupalcode.org/project/ui_patterns/-/merge_requests/540

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.