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

adjust bfe.json so that only classic has sigils #20

Merged
merged 1 commit into from
Aug 19, 2021
Merged

Conversation

staltz
Copy link
Member

@staltz staltz commented Aug 16, 2021

Context: See ssbc/ssb-meta-feeds-spec#19, only classic SSB refs would have sigils, so I started working on updating ssb-bfe (JS) to use SSB URIs for all non-classic type/formats and it required updating ssb-bfe-spec.

The main change is in bfe.json, there is now format.sigil alongside format.suffix, whereas before it was type.sigil (making an assumption that the sigil applies universally for that type). I also renamed msg to message because if we are to use bfe.json programatically, we have to build the URI from it, and ssb:msg/ed25519/ is not an official SSB URI, it's ssb:message/ed25199/.

@staltz staltz requested review from mixmix and arj03 August 16, 2021 12:27
@staltz staltz marked this pull request as draft August 16, 2021 12:31
Copy link
Member

@mixmix mixmix left a comment

Choose a reason for hiding this comment

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

My only concern is that we're channing a bunch of named types which means major changes in ssb-bfe (and here if we're at v1, can't remember)

I think this is the right way.

Oh, did you write a test :every format with a sigil has a suffix?

return [...acc, ...type.formats.filter((format) => format.suffix)]
}, [])
const sigils = new Set()
loopOverTypes: for (const type of bfeTypes) {
Copy link
Member

Choose a reason for hiding this comment

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

This is new syntax to me!

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe the first or second time ever that I find a legit use case for it :)

Copy link
Member

Choose a reason for hiding this comment

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

What's it called so I can learn what it is

Copy link
Member Author

Choose a reason for hiding this comment

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

...acc,
...type.formats.filter((format) => !format.sigil && format.suffix)
]
, [])
Copy link
Member

Choose a reason for hiding this comment

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

Nice refactor of tests

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't really want to refactor it, but changing the structure of the json forced me to rethink this file, it would have been hard to keep it like it was before, so I just saved some time and followed the spirit of the previous test

@staltz staltz marked this pull request as ready for review August 19, 2021 13:30
@staltz staltz merged commit b41357c into master Aug 19, 2021
@staltz staltz deleted the support-ssb-uris branch August 19, 2021 13:31
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.

None yet

2 participants