FOSJsRoutingBundle
FOSJsRoutingBundle copied to clipboard
The routing file "/application/config/routes/fos_js_routing.yaml" contains unsupported keys for "fos_js_routing"
i installed version 3.1, using symfony 6, the package created fos_js_routing.yaml in config/routes folder with content
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing-sf4.xml"
i have added a key routes_to_expose as per documentation
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing-sf4.xml"
routes_to_expose: ['^handle_[\S]+']
when i run dump command or any symfony command or even try to visit the web app i get this error
In FileLoader.php line 172:
The routing file "/application/config/routes/fos_js_routing.yaml" contains unsupported keys for "fos_js_routing": "routes_to_expose". Expected one of: "r
esource", "type", "prefix", "path", "host", "schemes", "methods", "defaults", "requirements", "options", "condition", "controller", "name_prefix", "trail
ing_slash_on_root", "locale", "format", "utf8", "exclude", "stateless" in /application/config/routes/fos_js_routing.yaml (which is being imported from "/
application/src/Kernel.php").
In YamlFileLoader.php line 258:
The routing file "/application/config/routes/fos_js_routing.yaml" contains unsupported keys for "fos_js_routing": "routes_to_expose". Expected one of: "r
esource", "type", "prefix", "path", "host", "schemes", "methods", "defaults", "requirements", "options", "condition", "controller", "name_prefix", "trail
ing_slash_on_root", "locale", "format", "utf8", "exclude", "stateless".
has anything changed in configuration? is the documentation outdated? thanks
ugh, apparently it matters in which file you write that. more symfony magic :(
aha, but if i creae a file config/config.yml and put
fos_js_routing:
routes_to_expose: ['^handle_[\S]+']
the route doesnt get exposed
what do i need to do for it to work properly? thanks in advance
Hi @bazo, thanks for contacting us. The documentation is somewhat outdated since this bundle was set up when Symfony 2 was still the latest... By now Symfony has changed to the file extension .yaml
instead of .yml
, and they have decoupled the package/bundle configuration from the main service configuration. You can create/edit the file config/packages/fos_js_routing.yaml
and add your configuration for this bundle there.
I think it would be nice to update the documentation and add a sample configuration to the recipe to make it more developer-friendly, so feel free to open a PR if you think you can add something there (otherwise I will do that somewhere in the future, but it might take a while).
BTW I don't agree with your statement about Symfony magic 😉 I think separating routing information from your application configuration makes a lot of sense, but it can take a while to get comfortable with all the concepts I imagine
thanks, now it works. creating a config file under packages helped. thanks for such quick reply.