Re-think HTTP API Documentation #69
Description
One of the things I called out in the current docs PR (#68) and in the research is the issues around the HTTP API docs (https://ipfs.io/ipfs/QmVUdHfpo9hyC8wXmgd2frRrsp83iRvuL8HWyp1LPzjsPq/reference/api/http/). Virtually every user I’ve talked with finds them to be pretty bad (sometimes entirely unhelpful) and has cheered when shown the interface-ipfs-core
“specs,” even though they don’t cover HTTP-specific concerns! Specifically:
-
They are way too thin. All the in-depth docs in the Go code (where the HTTP docs are generated) can’t be used because they are very specific to the CLI and would be confusing for HTTP.
-
They are specific to the Go implementation (they miss anything that might be unique to
js-ipfs
; they include without noting the situation things that are unique togo-ipfs
) -
They don’t cover changes over time.
I do think it’s helpful that there is a single HTTP API reference and that it’s not buried inside the Go-specific docs because the recommended model for programmatic usage is to treat it like PostgreSQL or Redis, where it should run as a separate process locally. So I don’t think the right solution is to generate implementation- and version-specific docs and put them alongside the js-ipfs
and go-ipfs
docs.
I see two possible solutions here:
-
Maintain HTTP API docs separately, by hand, rather than generating them from
go-ipfs
.- Upside: it’s all in one place and not repeated; it’s specific to the HTTP use case.
- Downside: the docs are no longer in/alongside the code. It’s a lot more effort to update. It requires more coordination between Go and JS teams.
-
Add a
LongHttpDescription
field tocmdkit.HelpText
in Go and some similar way of generating HTTP API docs fromjs-ipfs
. Generate implementation- and version-specific HTTP API docs for each and put them in the “JS Implementation” and “Go Implementation” sections of the docs site. Keep a top-level one that is just a copy of the current release version of the Go HTTP docs, but make sure it includes links to the HTTP docs for all the other versions/implementations.- Upside: docs are stored alongside the code; it’s easier for people to maintain and keep up-to-date as part of their regular coding work and harder to get out of sync with the implementation; it’s easier to let the JS parts be JS-specific and same for Go.
- Downside: the vast majority of content will be duplicated and it’s a lot of manual work to make sure the two implementation’s inline docs stay in sync (but we are more-or-less already doing it with CLI help text). We have to invent whole new structures in the tooling for it — in both implementations.
I propose doing # 1. It is less technologically savvy, but makes it easier to separate HTTP-specific concerns and to play with various ways of documenting things. Does anybody have strong opinions about either (or a different, better idea)?