Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UUID Path Bindable - Play Framework

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

like image 945
Ali Salehi Avatar asked Jul 28 '15 06:07

Ali Salehi


1 Answers

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.

like image 104
colinjwebb Avatar answered Nov 11 '22 11:11

colinjwebb