Problem/Motivation
I created a new recipe and used the "focal_point_crop_by_width" effect.
But when installing the recipe, an error occurs:
There were validation errors in image.style.teaser:
- effects.97927909-6b76-43c2-8c12-9457ad56c4dc.data: 'width' is an unknown key because effects.97927909-6b76-43c2-8
c12-9457ad56c4dc.id is focal_point_crop_by_width (see config schema type image.effect.*).
- effects.97927909-6b76-43c2-8c12-9457ad56c4dc.data: 'height' is an unknown key because effects.97927909-6b76-43c2-
8c12-9457ad56c4dc.id is focal_point_crop_by_width (see config schema type image.effect.*).
- effects.97927909-6b76-43c2-8c12-9457ad56c4dc.data: 'crop_type' is an unknown key because effects.97927909-6b76-43
c2-8c12-9457ad56c4dc.id is focal_point_crop_by_width (see config schema type image.effect.*).
Proposed resolution
Add the "focal_point_crop_by_width" effect into the schema.yml.
I wrote a patch to fix this.
| Comment | File | Size | Author |
|---|---|---|---|
| focal_point.schema.add_.focal_point_crop_by_width.effect.patch | 633 bytes | detroz |
Issue fork focal_point-3530779
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
Comment #4
sriram_s commentedThanks for the report and the patch @detroz, this is spot on.
I hit the same validation error using focal_point_crop_by_width in a recipe, and it's exactly what you found: there's no config schema entry for the effect, so width, height and crop_type all get flagged as unknown keys.
I've moved your fix into an MR (!59) so it can run through the current CI, and added a small kernel test so this doesn't quietly regress. The test builds an image style with the effect and checks the config validates against schema, it fails on the current code and passes once the schema is added.
Pipeline passes with warnings. phpunit is green. The cspell/eslint/phpcs/phpstan/stylelint warnings are already there on 2.x and none of them touch the files in this change.
Comment #5
csakiistvanComment #6
csakiistvanEnvironment
Prerequisites
focal_point_crop_by_widthimage effect is used in an image style (as happens when installing a recipe or importing config that defines it). Strict config schema validation runs on recipe install and config import.Steps
image.effect.focal_point_crop_by_widthentry toconfig/schema/focal_point.schema.yml.ddev drush crfocal_point_crop_by_widtheffect and validate its config against the schema:Expected results
focal_point_crop_by_widtheffect validates cleanly against the schema.width,height, orcrop_type.Actual results
Before the fix, validating an image style that uses the
focal_point_crop_by_widtheffect reports three "unknown key" violations —'width','height', and'crop_type'are all flagged because no config schema exists for the effect, which breaks recipe installation and config import. After adding the missingimage.effect.focal_point_crop_by_widthschema entry, validation returns zero violations and the effect config is accepted.Testing produced with the assistance of an LLM.
Comment #7
markconroy commentedUpdating version to patch against
Comment #9
rajeshreeputraMR Merged!