Problem/Motivation

The module does not provide schema for media.source.svg. Because of this, media bundles that use the "svg" source do not pass strict config validation.

Steps to reproduce

I'm not aware of scenarios where this produces a hard error in actual use. I ran into this in the context of writing a test for integration with this module:

<?php

declare(strict_types=1);

namespace Drupal\Tests\my_module\Kernel;

use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\media\Traits\MediaTypeCreationTrait;

/**
 * Produces a schema error.
 */
final class ReproduceSchemaErrorTest extends KernelTestBase {

  use MediaTypeCreationTrait;

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'field',
    'file',
    'image',
    'media',
    'svg_image_field',
    'system',
    'user',
  ];

  public function testMediaTypeCreation(): void {
    $this->createMediaType('svg', [
      'id' => 'svg',
      'label' => 'SVG',
    ]);
  }

}

Proposed resolution

Add config schema for media.source.svg, modeled after the schema definitions in the core Media module.

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

bvoynick created an issue. See original summary.

bvoynick’s picture

Status: Active » Needs review
alexpott’s picture

Status: Needs review » Reviewed & tested by the community

This would be great to fix. I've been using the same schema on a client project for over a year and it works great. Nice work @bvoynick

alexpott’s picture

I rebased the branch on top of the latest changes from 2.3.x

jwilson3’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the review and rebase. Merge pipeline to 2.3.x in progress.

  • jwilson3 committed 1cd3b670 on 2.3.x authored by bvoynick
    Issue #3464156: Module does not provide schema for media.source.svg
    
jwilson3’s picture

jwilson3’s picture

Status: Fixed » Closed (fixed)

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

jwilson3’s picture

This is now released in version 2.3.5 of SVG Image Field.

jwilson3’s picture

This is now released in version 2.3.5 of SVG Image Field. Please check release notes.