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

Add UUID path extractor #1953

Merged
merged 2 commits into from
Jul 18, 2018
Merged

Add UUID path extractor #1953

merged 2 commits into from
Jul 18, 2018

Conversation

tmfset
Copy link

@tmfset tmfset commented Jul 16, 2018

Add UUIDVar, a path extractor for java.util.UUID

I also considered adding a ValidatedUUIDVar to extract a Validated[Throwable, UUID] from paths but then realized that there is already a simple way to return BadRequest for invalid UUIDs:

HttpService[IO] match {
  case GET -> Root / "user" / UUIDVar(userId) => ...
  case GET -> Root / "user" / str => BadRequest(s"Invalid identifier '$str'")
}

The original PR targeted 0.18.x but broke binary compatibility, this new one targets master to avoid that complication.

Copy link
Member

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@ChristopherDavenport ChristopherDavenport left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Going to have merge conflicts on the merge train with the backwards compatible stuff.

@ChristopherDavenport ChristopherDavenport merged commit ca11aec into http4s:master Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants