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.

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

detroz created an issue. See original summary.

sriram s made their first commit to this issue’s fork.

sriram_s’s picture

Status: Active » Needs review

Thanks 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.

csakiistvan’s picture

Assigned: Unassigned » csakiistvan
csakiistvan’s picture

Assigned: csakiistvan » Unassigned
Status: Needs review » Reviewed & tested by the community

Environment

  • Drupal: 11.4.4
  • PHP: 8.5.5
  • Database: MariaDB 10.11.16
  • DDEV: v1.25.2
  • Focal Point: 2.1.2

Prerequisites

  • Focal Point module enabled.
  • The focal_point_crop_by_width image 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

  1. Apply the fix from MR !59: add the image.effect.focal_point_crop_by_width entry to config/schema/focal_point.schema.yml.
  2. Rebuild caches: ddev drush cr
  3. Create an image style that uses the focal_point_crop_by_width effect and validate its config against the schema:
    ddev drush php:eval '$s=\Drupal::entityTypeManager()->getStorage("image_style")->create(["name"=>"tester_fp","label"=>"Tester FP"]); $s->addImageEffect(["id"=>"focal_point_crop_by_width","weight"=>0,"data"=>["width"=>300,"height"=>200,"crop_type"=>"focal_point"]]); $s->save(); $c=\Drupal::config("image.style.tester_fp")->get(); foreach(\Drupal::service("config.typed")->createFromNameAndData("image.style.tester_fp",$c)->validate() as $v){print $v->getPropertyPath().": ".strip_tags((string)$v->getMessage())."\n";}'
  4. Compare the validation output before and after the fix.

Expected results

  • The config for an image style using the focal_point_crop_by_width effect validates cleanly against the schema.
  • No "unknown key" violations for width, height, or crop_type.
  • Recipes and config imports that define this effect install without validation errors.

Actual results

Before the fix, validating an image style that uses the focal_point_crop_by_width effect 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 missing image.effect.focal_point_crop_by_width schema entry, validation returns zero violations and the effect config is accepted.


Testing produced with the assistance of an LLM.

markconroy’s picture

Version: 2.1.2 » 2.x-dev

Updating version to patch against

  • sriram_s committed c69ceea1 on 2.x
    Issue #3530779 by detroz, sriram s: Add config schema for the...
rajeshreeputra’s picture

Status: Reviewed & tested by the community » Fixed

MR Merged!

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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.