Module does not provide schema for media.source.svg

Created on 27 July 2024, 5 months ago

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.

πŸ› Bug report
Status

Needs review

Version

2.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bvoynick

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024