-
Notifications
You must be signed in to change notification settings - Fork 22
Fix Apiary spec and align it with js-ipfs API #122
Comments
Where is this happening? |
@RichardLitt in many places, first example I can find here: https://github.com/ipfs/http-api-spec/blob/91922f0f4a400d279d2a8a009475c44c1a96e95c/apiary.apib#L36-L40
|
Fair. I'm not sure why I did this - can't find the documentation in the past issues. Would be good to fix. A lot of this code was influenced by the fact that I couldn't figure out how to do it automatically, or wasn't. |
Status report: :( go-ipfs API implementation seems to be built on top of the CLI commands (or maybe actual Core API). But operations do not translate very well to HTTP endpoints in some cases. js-ipfs seems to have implemented Go endpoints, except it usually offers less functionality than Go regarding options and operations modifiers. Headers and return objects and values differ among implementations sometimes. There is no consistency regarding which Content Type this API uses (text plain sometimes, json others etc). HTTP API tries to be an RPC API and is by no means a REST API. Apiary (or Swagger) are designed to document APIs which try to be RESTful, making the process more painful and generating suboptimal documentation. There are also some endpoints which are impossible to accurately document right now because they're just weird (things taking Because of this, there is little possibility (IMHO) that we can use API docs to auto-generate any serious test suite (let alone to test both implementations). Doing it is going to require to fight with lots of quirks. Therefore I'm in the process of thinning the apiary doc into a minimal usable set for the users that works both for js-ipfs and go-ipfs and that is not as long as now (longer -> more maintenance). That is:
I'll bring this discussion to the next all hands. Questions open:
Linking related issues: |
go-ipfs 'networked API' (currently over HTTP) was designed to be an API that is friendly to be mounted over any pipe/socket, then, due to browser requirements (more like restrictions) it had to be hammered into what we have today as an HTTP API Lots of very important context: https://github.com/ipfs/http-api-spec/issues/116
They are just not implemented yet
One of the big questions is, can we really have a canonical API for RPC and REST? Battle experience says no. Thank you for working on this, it has been a huge pain. Keep it coming :D |
After our monday conversation and the pain of manually dealing with Apiary I opted for writing a tool to simply generate the docs from Go. This materializes in the above's pull request (ipfs-inactive/website#156) and deprecates Apiary (and this repo) by removing the references from the website. By autogenerating the API reference directly from go code we get:
It provides a good base for addressing stuff in #116 . For the moment I'm considering Apiary spec "fixed". |
This sounds to me like the right approach. I wish we had more of a canonical source to look at, however, as this won't catch differences in the go implementation that should be in every IPFS implementation. However, it is probably a better use of our tooling to do this. I think that the ipfs/specs should cover what I want, anyway.
I like this. Deprecating this repo sounds fine. We should pull out any issues that we want covered, though, before closing them and putting a notice up. We should also remove references to the HTTP API. |
Also, good work! |
This issue corresponds to the "API alignment" milestone: ipfs/team-mgmt#227
A quick look upon the blueprint shows a number of issues (curl command used as expected request body etc). Additionally, the spec should be completely aligned to the js-ipfs implementation, which needs to be checked.
There are a number of open issues regarding the API which might be addressed in this effort. I'll be linking as I go,
The text was updated successfully, but these errors were encountered: