Skip to content

[#459] Omit empty lists in the json representation of `Expression`

Diogo Castro requested to merge diogo/#459-expression-json into master

Description

Problem: When serializing large Micheline Expressions, we can get really bloated JSONs, with lots of annots and args fields with empty lists.

Due to the introduction of TZIP-16, which says views should be stored as micheline expressions (possibly inside the contract's storage), we now have to be very careful to produce compact JSON values.

Solution: Change the ToJSON instance of MichelinePrimAp to omit annots and args when these lists are empty.

Related issue(s)

Resolves #459 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Merge request reports