Skip to content

[RFC][Validator] Configure XML or Yaml mappings for Validator #15655

Closed
@sroze

Description

@sroze

Right now, to use the validator component within a Symfony application, we need to configure the validation constraints as annotations or in XML or Yaml files in the Resources/config/validation directory or in a big Resources/config/validation.[x|y]ml file in a bundle directory.

In order to be able to re-use validation across libraries or just make the validation living where the user wants, I propose to introduce a validation mapping configuration in the framework configuration:

framework:
    validation:
        mappings:
            - %kernel.root_dir%/../src/Acme/Demo/Resources/validation
            - %kernel.root_dir%/../src/Acme/Library/Resources/validation.yml

The mapping values can be either a directory or a file. If it's a file, will be added as YML or XML based on the extension. If it's a directory, then using the finder we will be able to locate all the *.[x|y]ml files.

Before PR this feature, what do you think about it ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions