Ali Salehi
Ali Salehi

Reputation: 6999

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

Upvotes: 8

Views: 2365

Answers (1)

colinjwebb
colinjwebb

Reputation: 4378

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.

Upvotes: 18

Related Questions