Skip to content

fix(peer): Allow AddrInfo with empty ID field to round-trip through JSON#3516

Open
dimitar-kostadinov wants to merge 1 commit into
libp2p:masterfrom
dimitar-kostadinov:fix/addr-info-serde
Open

fix(peer): Allow AddrInfo with empty ID field to round-trip through JSON#3516
dimitar-kostadinov wants to merge 1 commit into
libp2p:masterfrom
dimitar-kostadinov:fix/addr-info-serde

Conversation

@dimitar-kostadinov

Copy link
Copy Markdown

The AddrInfo.MarshalJSON successfully serialise objects with empty ID field, but AddrInfo.UnmarshalJSON then failed because peer.ID.UnmarshalJSON rejects empty string.

The ID field in the addrInfoJson is tag with json:",omitempty" so an empty ID is omitted on marshal and left as the zero value on unmarshal.

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.

1 participant