Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support deserializing a 16 byte binary guid/uuid#2156

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
ramonsmits wants to merge4 commits intoMessagePack-CSharp:master
base:master
Choose a base branch
Loading
fromramonsmits:guid-deserialize-binary

Conversation

@ramonsmits
Copy link

When sending a uuid with javascript its a string. I tried sending aUint8Array but that failed to deserialize. Turns out in only supports text formatted uuid. This adds support for deserializing a 16 byte guid.

@ramonsmitsramonsmits changed the titleSupport derializing a 16 byte binary guid/uuidSupport deserializing a 16 byte binary guid/uuidFeb 12, 2025
@neuecc
Copy link
Member

Since we can expect GUIDs to come in various formats, I agree with making the deserialization somewhat flexible.
However, in the implementation, please be careful about unnecessary allocations.
Also, it's important to consider whether the approach is properly generalized.
If specialized handling is needed, I recommend preparing a separate formatter and combining it with the resolver.

@ramonsmits
Copy link
Author

ramonsmits commentedFeb 18, 2025
edited
Loading

However, in the implementation, please be careful about unnecessary allocations.

Fixed that

Also, it's important to consider whether the approach is properly generalized.

What does this mean? If many message pack serializeres serialize uuid as 16 byte big endian values?

If specialized handling is needed, I recommend preparing a separate formatter and combining it with the resolver.

I'm doing that now, but it felt such a common thing that I didn't expect that binary uuids were not supported. I didn't verify other runtimes/packages.

As you can see there is significant size savings. Imaging a type that has a few uuid properties. That is 20 byte per uuid.

@ramonsmits
Copy link
Author

ramonsmits commentedFeb 18, 2025
edited
Loading

@neuecc I also noticed this:

NativeGuidFormatter:

https://github.com/MessagePack-CSharp/MessagePack-CSharp/blob/v3.1.3/src/MessagePack/Formatters/UnsafeBinaryFormatters.cs

A remark on that type is the implementation only works on LITTLE endian environments.

Would it be ok to refactor this PR into a newNetworkOrderUuidFormatter that (de)serializes to a big endian 16 byte uuid? I think that makes sense.

@neuecc
Copy link
Member

Would it be ok to refactor this PR into a new NetworkOrderUuidFormatter that (de)serializes to a big endian 16 byte uuid

seems good.

ramonsmits reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@ramonsmits@neuecc

[8]ページ先頭

©2009-2025 Movatter.jp