New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anyAttribute support in routing.xsd #27408

Open
vbartusevicius opened this Issue May 29, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@vbartusevicius

vbartusevicius commented May 29, 2018

Description
Currenty it is practically impossible to extend routing.xml due to restrictions in routing.xsd

Example

<routes xmlns="http://symfony.com/schema/routing"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:vnd="custom-vendor.xsd"
    xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
    <route id="my_bundle.route_name" path="/category/{categoryId}">
        <default key="_controller">my_bundle.controller.category:someMethod</default>
       <vnd:my-attribute>something here</psr:api>
    </route>

Imagine we want to define custom logic how categoryId is mapped to Entity or how other things related to Request/Response are handled here. Allowing anyAttribute here would allow developers to recongize and configure some advanced logic they want without braking current functionality.

Currently developers are finding ways how to work-around this, in example:

  • FOSJsRoutingBundle uses <option key="expose">true</option> to mark route available in Javascript;
  • FOSRestBundle uses type: rest to mark resource as rest

Doctrine has this in their doctrine-mapping.xml: https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd - allows any attribute and any property.

I could provide PR to routing.xsd if this feature would be considered as useful.

@nicolas-grekas

This comment has been minimized.

Member

nicolas-grekas commented Jun 5, 2018

What would be the downside of doing this? e.g. could it make it harder to spot some mistakes?
Feel free to provide a PR of course.

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