You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add pageDataClass to ComponentPosition with write-side validation (#170)
ComponentPosition now stores pageDataClass (FQCN) alongside pageDataProperty.
Both fields must be set together or both null. ComponentPositionValidator
validates: pageDataClass is a known PageData resource, pageDataProperty is a
component-typed property on that class, and the resolved type is in
allowedComponents if configured. GroupBuilder.pageDataPosition() takes
pageDataClass as its new first argument.
### #170 — Component group `allowedComponents` does not validate `pageDataProperty` positions on write
579
+
### ~~#170 — Component group `allowedComponents` does not validate `pageDataProperty` positions on write~~ — FIXED
580
580
581
-
**Read side fixed** (commit `2305ad89`): `ComponentPositionNormalizer.normalizeForPageData()` now skips populating the component if the resolved type is not in `componentGroup.allowedComponents`. Direct-component write-side validation already works via `ComponentPositionValidator`.
581
+
**Read side fixed** (commit `2305ad89`): `ComponentPositionNormalizer.normalizeForPageData()` now skips populating the component if the resolved type is not in `componentGroup.allowedComponents`.
582
582
583
-
**`pageDataProperty` write-side still open:**When creating a `ComponentPosition` with `pageDataProperty` set, no validation is done against `allowedComponents`. The property name is just a string — the component type isn't known until render time.
583
+
**Write side fixed**(pending commit): `ComponentPosition` now stores a `pageDataClass` (FQCN) alongside `pageDataProperty`. `ComponentPositionValidator` validates the pair on every POST/PATCH: (1) `pageDataClass` must be a known API-registered PageData resource; (2) `pageDataProperty` must be a component-typed property on that class; (3) the resolved component type must be in `componentGroup.allowedComponents` if set. Both fields must be set together (entity-level `Assert\Expression` constraint).
584
584
585
-
**Agreed plan:** The module must send `pageDataClass` (FQCN of the PageData entity, e.g. `"App\\Entity\\ConferenceData"`) alongside `pageDataProperty` in POST/PATCH. The API can then resolve the property type and validate against `allowedComponents`. Requires coordinated change in both projects. See issue #170 (reopened) and nuxt module CLAUDE.md section on `allowedComponents` for the full spec.
585
+
**`CwaFixtureBuilder` updated:**`GroupBuilder.pageDataPosition()` now takes `pageDataClass` as its first argument: `->pageDataPosition(string $pageDataClass, string $propertyName, ?int $sort = null)`.
586
+
587
+
**Nuxt module action required:** The module must now send `pageDataClass` alongside `pageDataProperty` in POST/PATCH requests to `/_/component_positions`. See nuxt module CLAUDE.md for the consumer-side spec.
586
588
587
589
Related Nuxt module issue: `components-web-app/cwa-nuxt-module#151`.
0 commit comments