Skip to content

fix(serializer): omit absent optional fields instead of null - #128

Open
Steve0x2a wants to merge 1 commit into
wharfkit:masterfrom
Steve0x2a:fix/omit-absent-optional-null
Open

fix(serializer): omit absent optional fields instead of null#128
Steve0x2a wants to merge 1 commit into
wharfkit:masterfrom
Steve0x2a:fix/omit-absent-optional-null

Conversation

@Steve0x2a

Copy link
Copy Markdown

When an ABI optional field is absent, decode now omits the key instead of assigning null. Serializer.objectify also drops null keys so JSON-like output matches the Struct path.

eosio.msig::approve without proposal_hash previously round-tripped to {…, proposal_hash: null}, which wharfkit/wallet-plugin-cleos then passed to cleos and cleos rejected. Present optionals are unchanged. Top-level optional types such as public_key? still decode to null. Missing binary extensions still decode to null.

Credit @aaroncox for the report and repro.

Fixes #113

Signed-off-by: Yi Zhan <stevesough@gmail.com>
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.

Decoding of optional null values should not return null

1 participant