Buffalo changes route names from service to servex
Closed this issue · 5 comments
Description
I've noticed that if a resource has the word service in it such as mediaService
then Buffalo will create the following:
METHOD | PATH | NAME | HANDLER |
---|---|---|---|
GET | /media_services/ | mediaServicesPath | app/actions.MediaServicesResource.List |
POST | /media_services/ | mediaServicesPath | app/actions.MediaServicesResource.Create |
GET | /media_services/new/ | newMediaServicesPath | app/actions.MediaServicesResource.New |
DELETE | /media_services/{media_servex_id}/ | mediaServexPath | app/actions.MediaServicesResource.Destroy |
PUT | /media_services/{media_servex_id}/ | mediaServexPath | app/actions.MediaServicesResource.Update |
GET | /media_services/{media_servex_id}/ | mediaServexPath | app/actions.MediaServicesResource.Show |
GET | /media_services/{media_servex_id}/edit/ | editMediaServexPath | app/actions.MediaServicesResource.Edit |
Steps to Reproduce the Problem
I generated a resource called mediaService
Expected Behavior
I would expect the query parameter to be media_service_id
and associated paths on mediaServicePath
.
Actual Behavior
Buffalo created the query parameter as media_servex_id
and associated paths on mediaServexPath
.
Info
-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/local/go/bin/go
-> Go: Checking minimum version requirements
✓ Your version of Go, 1.17.1, meets the minimum requirements.
-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.
-> Go: Checking PATH
✓ Your PATH contains /home/fred/code/gopkg/bin.
-> Node: Checking installation
✓ The `node` executable was found on your system at: /usr/bin/node
-> Node: Checking minimum version requirements
✓ Your version of Node, v14.18.1, meets the minimum requirements.
-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /usr/bin/npm
-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.14.15, meets the minimum requirements.
-> Yarn: Checking installation
✓ The `yarnpkg` executable was found on your system at: /usr/bin/yarnpkg
-> Yarn: Checking minimum version requirements
✓ Your version of Yarn, 1.22.17, meets the minimum requirements.
-> PostgreSQL: Checking installation
✘ The `postgres` executable could not be found on your system.
For help setting up your Postgres environment please follow the instructions for you platform at:
https://www.postgresql.org/download/
-> MySQL: Checking installation
✘ The `mysql` executable could not be found on your system.
For help setting up your MySQL environment please follow the instructions for you platform at:
https://www.mysql.com/downloads/
-> SQLite3: Checking installation
✘ The `sqlite3` executable could not be found on your system.
For help setting up your SQLite3 environment please follow the instructions for you platform at:
https://www.sqlite.org/download.html
-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:
https://www.cockroachlabs.com/docs/stable/
-> Buffalo (CLI): Checking installation
✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo
-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.17.5, meets the minimum requirements.
-> Buffalo: Application Details
Pwd /home/fred/code/app
Root /home/fred/code/app
GoPath /home/fred/code/gopkg
PackagePkg app
ActionsPkg app/actions
ModelsPkg app/models
GriftsPkg app/grifts
WithModules true
Name app
Bin bin\app
VCS git
WithPop true
WithSQLite false
WithDep false
WithWebpack true
WithNodeJs true
WithYarn true
WithDocker true
WithGrifts true
AsWeb true
AsAPI false
InApp true
PackageJSON {map[build:webpack -p --progress dev:webpack --watch]}
-> Buffalo: config/buffalo-app.toml
name = "app"
bin = "bin\\app"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false
-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
binary = "buffalo-pop"
go_get = "github.com/gobuffalo/buffalo-pop"
[[plugin]]
binary = "buffalo-pop"
go_get = "github.com/gobuffalo/buffalo-pop/v2"
-> Buffalo: go.mod
module sst_app
go 1.16
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gobuffalo/buffalo v0.15.5
github.com/gobuffalo/buffalo-pop/v2 v2.3.0
github.com/gobuffalo/envy v1.9.0
github.com/gobuffalo/mw-csrf v0.0.0-20190129204204-25460a055517
github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130
github.com/gobuffalo/mw-i18n v0.0.0-20190129204410-552713a3ebb4
github.com/gobuffalo/mw-paramlogger v0.0.0-20190129202837-395da1998525
github.com/gobuffalo/packr/v2 v2.8.0
github.com/gobuffalo/pop/v5 v5.3.0
github.com/gobuffalo/suite v2.8.2+incompatible
github.com/gobuffalo/validate/v3 v3.1.0
github.com/gobuffalo/x v0.0.0-20190224155809-6bb134105960
github.com/markbates/grift v1.5.0
github.com/unrolled/secure v0.0.0-20190103195806-76e6d4e9b90c
)
Interesting. Could you please describe detailed reproduction steps?
Is it a new app or an existing app? The app uses old versions of core packages. (e.g. buffalo v0.15.5 while buffalo cli is 0.17.5)
Buffalo cli is 0.17.5. It's a new app that I initiated a couple weeks ago then I got a new computer. Installed buffalo cli and ran buffalo dev
. That's why buffalo is v0.15.5. Should I update the core packages?
Yeah, I think so.
Not sure why your new app has that go.mod
but the version you are using, v0.15.5, was released on 07 Feb 2020 and now we have v0.17.x.
I reproduced with your go.mod
with my existing app. Indeed, the issue was on buffalo v0.15.5 (or its dependency) and if you just remove the require
section from the go.mod
and rerun go mod tidy
within the app directory, your routes will be fixed without regeneration of those already created resources. The route information is not a configuration but a kind of live conversion dynamically generated by buffalo. (even though you can overrides some of them)
(IMO, if the app is a new app, I think there is no reason to keep old versions :-)
Thanks for your help @sio4! I'm happy that was the problem. At least now if anyone has a similar problem there will be some record of why it's happening.
Cheers!
Yeah, I agree, your issue could be a good reference for someone facing the same issue again. Thanks for reporting!