Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Define how toJSON() should look like #49

Closed
vmx opened this issue Nov 14, 2018 · 1 comment
Closed

Define how toJSON() should look like #49

vmx opened this issue Nov 14, 2018 · 1 comment
Labels
api-review Tackle during the API review

Comments

@vmx
Copy link
Member

vmx commented Nov 14, 2018

A toJSON() method is useful to have an easy way to interoperate with other tools. You can easily export data out of IPLD as most tools/languages understand JSON.

Though there should be guidelines on how data not natively support by JSON should be represented. For example binary data, but also CIDs.

For CIDs it would e.g. be possible to really split it into its separate parts. This way everyone consuming the JSON wouldn't need to be able to parse a CID, but could still get insight information about e.g. the coded.

@vmx vmx added the api-review Tackle during the API review label Nov 14, 2018
@vmx vmx added the ready label Nov 14, 2018
vmx added a commit that referenced this issue Nov 22, 2018
The whole IPLD APIs get a review to make them more consistent and
easier to use.

The biggest change is that there's not `resolve` API anymore. From
now on you access the properties of the JavaScript objects directly.

Issues that were taken into account:

 - #31
   - [x] Remove `isLink()` method from formats: `isLink()` is no
         longer needed as all links will be CID objects you can easily
         check for
 - #44
   - [x] Proposal: Move resolver to use CID instances for links: Not
         applicable anymore as `resolve.resolve()` is removed
 - #46
   - [x] properties: align spec with implementation: Covered by spec
 - #49
   - [x] Define how `toJSON()` should look like: Binary and CIDs are
         defined with example
 - #34
   - [x] Implementation of nested objects: Won’t fix as `tree()` is
         not part of the API anymore
vmx added a commit that referenced this issue Nov 22, 2018
The whole IPLD APIs get a review to make them more consistent and
easier to use.

The biggest change is that there's not `resolve` API anymore. From
now on you access the properties of the JavaScript objects directly.

Issues that were taken into account:

 - #31
   - [x] Remove `isLink()` method from formats: `isLink()` is no
         longer needed as all links will be CID objects you can easily
         check for
 - #44
   - [x] Proposal: Move resolver to use CID instances for links: Not
         applicable anymore as `resolve.resolve()` is removed
 - #46
   - [x] properties: align spec with implementation: Covered by spec
 - #49
   - [x] Define how `toJSON()` should look like: Binary and CIDs are
         defined with example
 - #34
   - [x] Implementation of nested objects: Won’t fix as `tree()` is
         not part of the API anymore

Closes #48.
@vmx vmx mentioned this issue Nov 22, 2018
5 tasks
@vmx
Copy link
Member Author

vmx commented Nov 28, 2018

toJSON() shouldn't be part of this spec. Serialization to JSON could live in a separate module. See #50 (review) for more information on that decision.

@vmx vmx closed this as completed Nov 28, 2018
@ghost ghost removed the ready label Nov 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-review Tackle during the API review
Projects
None yet
Development

No branches or pull requests

1 participant