For one of my routes I have an optional parameter i.e. birthDate: Option[String]
and can do this:
GET /rest/api/findSomeone/:firstName/:lastName controllers.PeopleController.findSomeone(firstName: String, lastName: String, birthDate: Option[String])
However, to be more strict with the birthDate
optional parameter it would be helpful to specify a regex like this:
$birthDate<([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))>
But since this is an optional parameter I can't find a way to do that .. it this covered in Play 2.7.x? I'm faced with the dilemma of making the birthDate
parameter non-optional or leaving it unchecked.
As a side note. I had been trying to integrate routes binding of Joda time e.g. org.joda.time.LocalDate
by adding the following dependency https://github.com/tototoshi/play-joda-routes-binder "com.github.tototoshi" %% "play-joda-routes-binder" % "1.3.0"
but it didn't work in my project as I get compilation errors after integrating it so I stashed that approach away for the time being.