Overview

#3582478: Symmetrically translatable config-defined component trees, STEP 2: change config schema type for `inputs` to allow translating via core's Config Translation UI tightens the config schema for config-defined component trees, to pave the path for translatability.

In doing so, the config schema for block component instances automatically is transparently reused: no more type: ignore, but instead type: block.settings.<block plugin ID>

This surfaced a long-hidden bug (AFAICT introduced in #3500997: Move SDC-specific validation in ValidComponentTreeConstraintValidator and ComponentTreeMeetsRequirementsConstraintValidator into the SDC source plugin) that causes root-level violations (at the root of block plugin settings) to generate incorrect property paths.

Proposed resolution

Fix.

User interface changes

None.

Issue fork canvas-3584143

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

wim leers created an issue. See original summary.

wim leers’s picture

Assigned: wim leers » Unassigned
Status: Active » Needs review

Ready for final review — see the two ℹ️ threads on the MR for guidance.

penyaskito’s picture

Status: Needs review » Reviewed & tested by the community

🚢 it!

wim leers’s picture

Assigned: Unassigned » wim leers
Issue tags: +Needs followup

Needs follow-up for https://git.drupalcode.org/project/canvas/-/merge_requests/899#note_745820 — that's out-of-scope technical debt that I'll try to address using a new PHPCS or PHPStan rule 🤞

Tagging to ensure I don't forget.

  • wim leers committed 065bdffc on 1.x
    fix(Component sources): #3584143 Incorrect property paths due to bugs in...
wim leers’s picture

Status: Reviewed & tested by the community » 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.

mayur-sose’s picture

Verified the API validation path mapping for block components:

ID Test Scenario Steps Expected Result Pass/Fail
1.1 Root-Level Block Setting Violation 1. Send a POST/PATCH request to Page API.
2. Include a block component but omit a required root-level setting.
3. Inspect the 422 JSON response.
The property path correctly points to the exact root-level input (e.g., elements.[uuid].inputs.[setting_name]) without malformed segments or double dots. Pass
1.2 Nested Block Setting Violation (Regression) 1. Send an API request modifying a block with deeply nested config.
2. Provide an invalid value for a deep setting (e.g., config.advanced.toggle).
3. Inspect the 422 response.
The property path accurately reflects the deep nesting traversal. The fix for root-level paths did not break nested mapping. Pass
2.1 Standard Component Violation (Regression) 1. Send an API request including a standard SDC.
2. Intentionally violate a validation rule on the SDC's inputs.
3. Inspect the 422 response.
The property path maps correctly to the SDC's inputs. Standard components remain unaffected by the changes to ConstraintPropertyPathTranslatorTrait. Pass
3.1 Valid Block Component Save 1. Construct a valid payload with a block component.
2. Send the POST/PATCH request to save the Canvas Page.
API returns 200/201 Success. The schema validation passes without throwing false positives. Pass