- Issue created by @Grimreaper
When working on ✨ UI Suite Bootstrap: Define form elements from SDC Active , we defined an object for options handling optgroup like this:
options:
title: "Options"
# @todo promote this structure as prop type.
type: object
additionalProperties: false
patternProperties:
".+":
anyOf:
- type: string
- type: object
patternProperties:
".+": {type: string}
The problem is that it is detected as an Attribute prop type.
In https://git.drupalcode.org/project/ui_patterns/-/blob/2.0.x/src/SchemaMa..., there is a logic problem in :
/**
* When the schemas are using anyOf property, are they compatible?
*/
protected function isAnyOfCompatible(array $checked_schema, array $reference_schema): bool {
if (isset($reference_schema["anyOf"])) {
foreach ($reference_schema["anyOf"] as $schema) {
if ($this->isCompatible($checked_schema, $schema)) {
return TRUE;
}
}
}
if (isset($checked_schema["anyOf"])) {
foreach ($checked_schema["anyOf"] as $schema) {
if ($this->isCompatible($schema, $reference_schema)) {
return TRUE;
}
}
}
return FALSE;
}
Some notes with @pdureau:
ATTRIBUTE PROP TYPE
anyOf:
- type: string
- type: array
KO:
anyOf:
- type: object
- type: string
OK:
anyOf:
- type: string
OK:
type: string
Active
2.0
Code