-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
need/analysisNeeds further analysis before proceedingNeeds further analysis before proceedingneed/community-inputNeeds input from the wider communityNeeds input from the wider communityneed/maintainers-inputNeeds input from the current maintainer(s)Needs input from the current maintainer(s)topic/http-gateway
Description
Current state
Gateway provided by go-ipfs 0.8.0 supports only dag-pb (unixfsv1) and raw (raw block used for leaves) codecs.
Requesting any other IPLD type over a gateway fails.
Where we want to be
It should be possible to download everything over Gateway:
- If it is impossible to provide web-compatible response, at the bare minimum we should return DAG archive (eg. as CAR – IPFS auto-updating kubo#170) so one can download it and then
ipfs dag import <dag-archive>it to own node. - Gateway could return more useful response for some IPLD types (like
dag-cbor)
Low-hanging fruit: traversable JSON/CBOR documents
Some ideas how to maximize the utility of gateways (those are just prompt for discussion, details TBD):
- there should be a mechanism for controlling if
dag-cboranddag-jsonare returned as a valid JSON response withContent-type: application/jsonorapplication/cbor - it should be possible to traverse CBOR documents if one of the fields points at a CID
Ongoing work
- @alanshaw is adding CBOR support in feat: serve CBOR encoded DAG nodes from the gateway kubo#8037
Open questions
- Is CAR something we want to introduce, or do we want to wait for "CARv2" like anorth/go-dar
- Should it be possible to include non-unixfs nodes inside of a unixfs directory? (this impacts MFS and ipfs-webui)
- What should be the default response type for
dag-cbor? User will be able to choose, but what happens when there is no user preference? (Original binary or should Gateway return JSON as its more user friendly and makes onboarding easier?)- I was initially locked on keeping original format at all cost, but I now see how returning JSON for
dag-cborby default make it work out-of-the-box in browser after copying and pasting the CID, which makes our stack "feel" approachable and easy to understand. This is huge for onboarding new users (devs).
- I was initially locked on keeping original format at all cost, but I now see how returning JSON for
- Should we support graphql-like queries against dag-cbor, so only specific fields are returned (think
/ipfs/{dag-cbor-cid}?keys=image,name)? (This is separate from traversing CID tags in CBOR)- This could be a hidden killer feature when it comes to building web apps against the gateways.
Any reason to not do this? Does this clash conceptually with planned support for selectors?
- This could be a hidden killer feature when it comes to building web apps against the gateways.
- Do we need to bikeshed how the format parameter should look like on Gateway?
- This will be something that can be added to every path to override the default representation, used in both feat: serve CBOR encoded DAG nodes from the gateway kubo#8037 AND Gateway: client opt-in JSON responses for directory listing kubo#7552
- We already support
--enc=jsonon CLI,?enc=jsonis short and easy to add by hand to URL - trivial important for dx/ux - If we plan to support responses other than dag-json and dag-cbor, we make it accept
namefrom multicodec/table.csv- If we go with multicodec table,
?codec=or?format=may be better than?enc=(are they?)
- If we go with multicodec table,
- 👉 (i am sure there is more, please comment below)
Metadata
Metadata
Assignees
Labels
need/analysisNeeds further analysis before proceedingNeeds further analysis before proceedingneed/community-inputNeeds input from the wider communityNeeds input from the wider communityneed/maintainers-inputNeeds input from the current maintainer(s)Needs input from the current maintainer(s)topic/http-gateway