Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: migration to new multiformats #28

Merged
merged 2 commits into from
Oct 9, 2020
Merged

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Oct 5, 2020

BREAKING CHANGE!

now import { encode, decode } from '@ipld/dag-json'

update README
add LICENSE files

Closes #27

BREAKING CHANGE!

now `import { encode, decode } from '@ipld/dag-json'`

update README
add LICENSE files

Closes #27
@rvagg rvagg requested review from mikeal and Gozala October 5, 2020 06:39
Copy link
Contributor

@Gozala Gozala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks for updating it @rvagg. My only concern is that this does not use provided codec function and just implements interface, so any changes made would need to be coordinated.

const name = 'dag-json'
const code = 0x0129

export { encode, decode, name, code }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest following instead:

import { codec } from 'multiformats/codecs/codec'
export default codec({ name, code, encode, decode })

Because it will:

  1. Create a codec that is implements both encoder and decoder ends
  2. Expose encoder and decoder ends separately.
  3. If we do end up adding some kind of contaminators, dag-json would automatically get that as well.

@Gozala
Copy link
Contributor

Gozala commented Oct 7, 2020

Just got to the dag-pb PR where some of this was discussed. I posted a bit more justification to my position there ipld/js-dag-pb#3 (comment)

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.

Update for compatibility with multiformats 4 configuration-free API
3 participants