diff --git a/src/JsonForms/ScopePointer.php b/src/JsonForms/ScopePointer.php index 7ef3caf..f60debd 100644 --- a/src/JsonForms/ScopePointer.php +++ b/src/JsonForms/ScopePointer.php @@ -84,7 +84,24 @@ public function getPath(): array { * @return array */ public function getPropertyPath(): array { - return array_values(array_filter($this->getPath(), fn ($value) => 'properties' !== $value && '' !== $value)); + $consecutivePropertiesCount = 0; + return array_values(array_filter( + $this->getPath(), + function ($value) use (&$consecutivePropertiesCount) { + // There might be a property named "properties" and the corresponding + // scope would contain ".../properties/properties/...". Thus, we cannot + // just filter out every occurrence of "properties". + if ('properties' === $value) { + $consecutivePropertiesCount++; + + return $consecutivePropertiesCount % 2 === 0; + } + + $consecutivePropertiesCount = 0; + + return '' !== $value; + } + )); } public function getScope(): string {