question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

metadata.toJSON does not respect typesAlias

See original GitHub issue

Hi, I’m using the latest version of the polkadotjs. I found a problem that the typeAlias does not work when I use metadata.toJSON(). But the interesting thing is that if I use metadata.aslate.toJSON(), the type can be overwritten normally. I want to know whether this is a bug or a feature. The data I use is the https://github.com/polkadot-js/api/blob/master/packages/metadata/src/Metadata/v12/static.ts It works at 1.30.1 and V11

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jacogrcommented, Oct 8, 2020

In the above, as a work-around for now, this should do the trick while solution is pending.

const metadata = new Metadata(registry, '0x......');

// HACK to populate registry
metadata.asLatest.toJSON();

const newMetadata = new Metadata(registry, metadata.toJSON())

The additional asLatest (while the output is not used), will enhance the registry so subsequent uses will have the added types.

0reactions
polkadot-js-botcommented, Jun 2, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type metadata in JSON is apparently not honored if $ ...
Type metadata in JSON is apparently not honored if $type is not the first property in the object. Save this question. Show activity...
Read more >
Json metadata does not support serialize feature #391
After initial gem setup with t.json :metadata, default: {} field I've got this ... Json metadata does not support serialize feature #391.
Read more >
Loading, Converting, and Writing JSON Files - GitHub Pages
Situation 1: No nesting, no metadata​​ If the JSON has no nesting - that is, if every key is associated with a single...
Read more >
Working with Dataset-JSON using SAS©
METADATA. Reading and writing Dataset-JSON files does not only require data as input but also metadata. For the. SAS programs in this paper ......
Read more >
External Data Metadata Format Reference
The metadata describes the structure of external data files. The metadata file is in JSON format. The .json file consists of 3 main...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found