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

Only delete is excluded from route groups. #97

Closed
minpeter opened this issue Mar 22, 2024 · 5 comments
Closed

Only delete is excluded from route groups. #97

minpeter opened this issue Mar 22, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@minpeter
Copy link
Contributor

ref: #96 (comment)

To Reproduce
Steps to reproduce the behavior:

  1. Follow the tutorial crud.
  2. In swagger, only the delete method does not belong to a group. (see bug)

Expected behavior
Naturally, it exists in the same group including delete

Screenshots
image

func (rs FilesRessources) Routes(s *fuego.Server) {
	filesGroup := fuego.Group(s, "/files")

	fuego.Get(filesGroup, "/", rs.getAllFiles)
	fuego.Post(filesGroup, "/", rs.postFiles)

	fuego.Get(filesGroup, "/{id}", rs.getFiles)
	fuego.Put(filesGroup, "/{id}", rs.putFiles)
	fuego.Delete(filesGroup, "/{id}", rs.deleteFiles)
}

Framework version (please check if it happens with the last Fuego version before posting):
latest

Go version (please check if it happens with the last Go version before posting):
go version go1.22.1 linux/amd64

@minpeter minpeter added the bug Something isn't working label Mar 22, 2024
@minpeter
Copy link
Contributor Author

Paths using Std lib compatibility will also not belong to the group.

@EwenQuim
Copy link
Member

You can Tag manually the routes with.Tags(), check the docs!


Automatic Tags are based on return type, not on the first /<thing>. This is why std lib routes and delete route (that does not have a return type!) arent registered with the tag you expect.

Does it seems more logical for you to tag them by the first slash ?

Should we have an option to choose between the 2 options (return type VS first slash) ?

Think about the /books/<id>/authors route. In which Tag must it belong ?

@minpeter
Copy link
Contributor Author

Obviously books group tag,
From my point of view the first slash option looks quite good.

@EwenQuim
Copy link
Member

I'll talk to the team about that. We might be doing this for the next release :)

@minpeter
Copy link
Contributor Author

image

func (rs FilesRessources) Routes(s *fuego.Server) {
	filesGroup := fuego.Group(s, "/files")
	fuego.Get(filesGroup, "/", rs.getAllFiles)
	fuego.Post(filesGroup, "/", rs.postFiles)
	fuego.GetStd(filesGroup, "/{id}/{name}", rs.downloadFile).Tags("files")
	fuego.Get(filesGroup, "/{id}", rs.getFiles)
	fuego.Delete(filesGroup, "/{id}", rs.deleteFiles)
}

.tags worked fine. thank you

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

No branches or pull requests

2 participants