Skip to content

Improve configuration validation #7053

Description

@kira0269

Description
Bundle configuration does not check if required package is installed before configuring associated services.

Example
In ApiPlatform\Symfony\Bundle\DependencyInjection\ApiPlatformExtension.php, we will configure the availble formats. If we try to configure the format jsonhal:

api_platform:
title: Hello API Platformversion: 1.0.0formats:
jsonld: [ "application/ld+json" ]jsonhal: [ "application/hal+json" ]

An exception is thrown saying "Invalid service "api_platform.hal.normalizer.entrypoint": class "ApiPlatform\Hal\Serializer\EntrypointNormalizer" does not exist".

Proposal
In ApiPlatform\Symfony\Bundle\DependencyInjection\ApiPlatformExtension.php, check for required libraries associated with specific configuration.
In the previous example, error message could be "Trying to configure jsonhal format, but required package api-platform/json-hal is not installed"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions