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

Zero addresses should be omitted from asset information instead of being serialized as a zero address. #939

Open
AlterionX opened this issue Mar 19, 2022 · 1 comment
Labels

Comments

@AlterionX
Copy link

AlterionX commented Mar 19, 2022

Problem

The serializer spits out a zero address instead of no address for optional fields. This behavior is mildly unexpected and also differs from the algod API.

For languages with well-known Optional values, it's mildly annoying (and potentially error prone) to need to check if the address is a zero value and swap it out with an "empty" value instead of just having the value be that well known optional value in the first place. (undefined for JS, None for Python, Option in Rust, std::optional in C++, Optional in Java. This doesn't really apply to golang, since golang uses zero values instead, but it's prevalent enough elsewhere to be a relatively widespread annoyance.)

It may also save on a not-insignificant chunk of bandwidth when considered in requests for large quantities of data.

For more information: manuelmauro/algonaut#142.

Solution

Make the serializer understand that it should skip a zero-valued address. (It's possible there are other places that are also marked optional in the Indexer REST API docs.)

Dependencies

Maintainers of the various deserialization libraries would need to tweak their implementation to properly react to this.

Urgency

Low. It's fairly simple to work around this problem.

Acceptance Criteria

  • Convert the optional fields to optional, rather than required in the spec.
  • Create tasks to update the SDKs.
@AlterionX AlterionX added the new-feature-request Feature request that needs triage label Mar 19, 2022
@winder
Copy link
Contributor

winder commented May 7, 2022

Related to #597

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants