7
votes

In my build.sbt I have

routesImport += "play.api.mvc.PathBindable.bindableUUID"

And in my routes I have:

GET      /groups/:id     controllers.GroupController.get(id)

And in my controller I have

class GroupController { ....

   def get (id: UUID)   

I am getting the following error for the above route

type mismatch;
 found   : String
 required: java.util.UUID

How can used uuid in path in routes file in Play. I am using play 2.4.2 - scala 2.11.7

1

1 Answers

17
votes

String is the default type for parameters in the routes file. To change this, you need to explicitly specify a type for the Id:

GET      /groups/:id     controllers.GroupController.get(id: java.util.UUID)

If you do that, you should find you can also delete the import of bindableUUID in your build file.