Skip to content
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

[Router] Configure trailing slash on root globally #43059

Open
flohw opened this issue Sep 16, 2021 · 2 comments
Open

[Router] Configure trailing slash on root globally #43059

flohw opened this issue Sep 16, 2021 · 2 comments
Labels

Comments

@flohw
Copy link

@flohw flohw commented Sep 16, 2021

Description
Create a global option to allow configuration of the trailing_slash_on_root option at route level.

As I am building an api, I never need the trailing slash and I have to mention the option on a lot of place with the false value. As for me false should be the default value and I don't remember if I need to configure at the leaf route level or if I can define at the parent level (root level seems to not work), I would like to have a framework.router.trailing_slash_on_root configuration (name has to be defined) could be an improvement on this.

The option appears 53 times in my code, always with false value.

Example

# a-lot-of-my-routes-configuration-files.yaml
api_route_resource:
  resource: ./route-resource.yaml
  prefix: /route
  name_prefix: routes_
  trailing_slash_on_root: false

# Possible new config/packages/routing.yaml content
framework:
    router:
        trailing_slash_on_root: false

# new-a-lot-of-my-routes-configuration-files.yaml
api_route_resource:
  resource: ./route-resource.yaml
  prefix: /route
  name_prefix: routes_

I hope this idea can help some people and I am not the only one concerned. Also I hope to not have missed something in the documentation. ;-)

Thank you.

@Tobion
Copy link
Member

@Tobion Tobion commented Sep 16, 2021

i don't think the name of trailing_slash_on_root makes sense on a global route config. the "root" means the root of the import (only consisting of the prefix). at the global level there is no "root". it would would probably require a different name.
And I think it was already discussed at the original issue/pr of this feature.

@flohw
Copy link
Author

@flohw flohw commented Sep 17, 2021

Yes, I agree that the name is not ideal. I choose to use it only for a better comprehension. It can be changed.

Maybe trailing_slash would be enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants