- Issue created by @pdureau
- π«π·France just_like_good_vibes PARIS
i just gave a test with a fresh 11.1.0 drupal and the last experience_builder from dev branch.
i did not receive the mentioned errors.
i managed to check the UI and almost nothing worked. My components were appearing but they are still in such an early stage, it seems difficult to check anything yet. - π«π·France pdureau Paris
No error? That s'great news. I will check again.
By the way, I know they are still very early stage, and I don't expect the builder to work properly, I just want the 2 JSON schema resolvers (
$ref: ui-patterns://
and$ref: json-schema-definitions://
) to work well together. - π«π·France pdureau Paris
No, it doesn't work.
Using XB components in UIP2
- I install both
ui_patterns_library
andexperience_builder
- I got to /admin/appearance/ui/components/experience_builder/shoe_button
- icon prop has this unknown prop type:
{"$ref":"json-schema-definitions:\/\/experience_builder.module\/shoe-icon","type":"object"}
According to https://git.drupalcode.org/project/experience_builder/-/blob/0.x/schema.... the expected resolved json schema must be
title: Icon type: object properties: name: type: string title: Name default: primary enum: - moon-stars-fill - moon-stars - star-fill - star - stars - rocket-fill - rocket-takeoff-fill - rocket-takeoff - rocket
Which will be loaded as Enum prop by UIP2.
So, what is happening? Why the JSON schema reference is not resolved?
- It is broken on Experience Builder side?
- Is it broken because of having XB & UIP2 together?
Using UIP2 components in WB
I was not able to test because XB is currently broken:
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "experience_builder.experience_builder" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 211 of core/lib/Drupal/Core/Routing/RouteProvider.php).
Let's try later.
- I install both
- π©πͺGermany Christian.wiedemann
christian.wiedemann β made their first commit to this issueβs fork.
- π«π·France pdureau Paris
Using XB components in UIP2
The issue was on UIP2 side. Fixed by Christian in https://git.drupalcode.org/issue/ui_patterns-3490873/-/commit/51c4ea3e22...
But he needs to add some tests.
Using UIP2 components in WB
We are not able to test because XB is currently broken (not the same bug as yesterday...). Let's wait a bit and pull again.
- π«π·France pdureau Paris
Today, we decided to merge this issue because the Using XB components in UIP2 fix is enough for RC1 (after adding some tests, right?).
About Using UIP2 components in WB:
- It seems XB is not resvolving
$ref: ui-patterns://
but it may not resolved"$ref":"json-schema-definitions:
either, so let's wait they implement a working reference resolver - when both XB and UIP2 are installed, XB is raising errors, so our component plugin manager decorators may not be fully compatible
- XB is not loading UIP2 components (!) but is loading the
ui_patterns_blocks
's blocks twice, because of our (UIP2) context management; we derivate blocks twice, one with entity context and one without
Let's create a 2.1.0 issue.
- It seems XB is not resvolving
- π©πͺGermany Christian.wiedemann
This ticket takes way too long. The problem behind the phpunit error was that we don't validate the scheme correctly because we imported the refs after the validation. enum_list returns false empty values which leads than to the error. So I fixed the empty value handling of enum_list. I also try to test validation with schema.json like expierence_builder does. The problem here is that xb uses its own stream wrapper. All my tests with refs with local files doesn't work and I also could not find any solution to handle this. So i removed the the test again.
- π«π·France pdureau Paris
$values = array_filter($values, fn($value) => !is_null($value) && $value !== '');
Why are you removing the empty values? They can be legit in some enumerations. Is removing only the
null
values enough? - π©πͺGermany Christian.wiedemann
We need to remove empty strings if they are not part of the enum list. Propably we should remove all values which are not part of the enum list. Removing a entry from the enum list would lead to an exception which will be hard to fix for sitebuilders because the page crashes before. So I would suggest removing values which are not part of the enum list.
- π©πͺGermany Christian.wiedemann
Propably the bug occurst because EnumTrait::normalizeEnumListSize is not triggerd before. I will investigate that.
- π«π·France pdureau Paris
We need to remove empty strings if they are not part of the enum list. Propably we should remove all values which are not part of the enum list
It is nice to do it in the source plugin, but the prop type plugin have a
::normalization()
method. - π©πͺGermany Christian.wiedemann
Okay I checked it again. We need to load non ui-patterns references first and after that we load ui patterns references. So actual problem was a wrong schema guessing if we load all references and than we do prop type guessing only on schema (without $ref="ui-patterns://").
So I split the ref loading in two steps. This should work. But we can also wait for rc2 with this fix. Not sure if "ref" is often used in SDC right now without custom stream wrappers like xb is doing. - π«π·France pdureau Paris
Not sure if "ref" is often used in SDC right now without custom stream wrappers like xb is doing.
There are 2 ways of using the JSON Schema
$ref
system AFAIK:- With a custom stream wrapper like we do in UI Patterns 2 (
ui-patterns://
with StreamWrapper) and Experience builder (json-schema-definitions://
with JsonSchemaDefinitionsStreamwrapper) - With simple URI retrieval when the URI is dereferencable: http(s), file, ftp...
- With a custom stream wrapper like we do in UI Patterns 2 (
-
pdureau β
committed a74a9412 on 2.0.x authored by
christian.wiedemann β
Issue #3490873 by christian.wiedemann, pdureau, just_like_good_vibes:...
-
pdureau β
committed a74a9412 on 2.0.x authored by
christian.wiedemann β
Automatically closed - issue fixed for 2 weeks with no activity.