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

Can't create routes with name begin in number #144

Open
012e opened this issue Jun 20, 2022 · 4 comments
Open

Can't create routes with name begin in number #144

012e opened this issue Jun 20, 2022 · 4 comments
Labels
bug Something isn't working needs decision Need to think more and decide

Comments

@012e
Copy link
Contributor

012e commented Jun 20, 2022

When we create a route with a number at the beginning

❯ bud new controller 1 index
| 1:9: expected 'IDENT', found 1

The controller is not generated but the view is.

view/
├── 1
│   └── index.svelte
└── index.svelte
controller/
└── controller.go

Result in

view: render error conjure: generate "bud/view/_ssr.js". ✘ [ERROR] [plugin tranform_svelte_to_js] Unexpected token (2:9)
1: <script>
2:   export let 1s = []
            ^
3: </script>
4:

    svelte:./bud/view/1/index.svelte:2:29:
      2 │ import View1IndexSvelte from "./view/1/index.svelte"
@012e 012e changed the title Should not be able to create routes with name begin in number Can't create routes with name begin in number Jun 20, 2022
@matthewmueller matthewmueller added the bug Something isn't working label Jun 21, 2022
@matthewmueller
Copy link
Contributor

matthewmueller commented Jun 21, 2022

Ah good catch. I'm assuming you wanted multiple versions? For now, I'd probably suggest v1, v2.

If you manually fix that export does the rest of bud work? I'm wondering if the controller props are also affected.

@012e
Copy link
Contributor Author

012e commented Jun 21, 2022

If you manually fix that export does the rest of bud work?

No it doesn't work, just 404 page not found

@matthewmueller
Copy link
Contributor

matthewmueller commented Jun 27, 2022

Need to think more about this one. Can you explain why you want this @012e?

It's definitely possible to have controller/1/controllers.go, with the following:

package controller
type Controller struct {}
func (c *Controller) Index() { }

But the package /1 isn't really resourceful. Maybe it's nice for versioning? But then you could do v1/ which I think is more clear. I'm leaning towards handling this in custom routes.

@012e
Copy link
Contributor Author

012e commented Jun 28, 2022

I don't need this. It's just an edge case I found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs decision Need to think more and decide
Projects
None yet
Development

No branches or pull requests

2 participants