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 json format #313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

atararaksin
Copy link

@atararaksin atararaksin commented Jul 29, 2019

This PR adds an instance of JsonFormat[UUID] as requested in #243.
I'm not sure as to where to place this object, currently BasicFormats is my best guess, but feel free to request any changes.

Closes #243

@plokhotnyuk
Copy link

plokhotnyuk commented Jul 29, 2019

@atararaksin UUID.fromString behaves differently on different versions of Java and allows illegal (or non standart) string values...

Please consider to pick a more efficient and stable implementation, like here or here

@atararaksin
Copy link
Author

@plokhotnyuk Thanks for pointing that out. I guess including fast-uuid as an external dependency is not a good option. Would it be appropriate (e.g. from the legal perspective) to borrow the implementation from jsoniter-scala?

@plokhotnyuk
Copy link

@atararaksin 1st one (from fast-uuid) is for sequences of characters.

While 2nd one (from jsoniter-scala) is for array of bytes - feel free to reuse if you will find something suitable there.

@Philippus
Copy link

Philippus commented Jul 31, 2019

This addition should make sure that uuid's follow RFC 4122, have a look at akka/akka-http#2569 and akka/akka-http#2596 for inspiration.

@plokhotnyuk
Copy link

plokhotnyuk commented Jul 31, 2019

@Philippus IMHO validation of the hexadecimal representation with dashes is enough... and limiting of allowed Msb bits will broke backward compatibility with NCS and custom extensions.

Also, using of regexp for that can be revised for more efficient implementation

Copy link

@Philippus Philippus left a comment

Choose a reason for hiding this comment

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

ProblemFilters.exclude[ReversedMissingMethodProblem]("spray.json.BasicFormats.UUIDJsonFormat") needs to be added to the mimaBinaryIssueFilters-setting in build.sbt.

@jrudolph jrudolph changed the base branch from master to release/1.3.x November 10, 2020 09:43
@jrudolph jrudolph changed the base branch from release/1.3.x to master November 10, 2020 09:44
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.

Json Format for java.util.UUID
3 participants