Skip to content

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

Open
@AlterionX

Description

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.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions