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

Document response formats for commands at /api/v0/ #888

Open
teknomunk opened this issue Dec 10, 2020 · 3 comments
Open

Document response formats for commands at /api/v0/ #888

teknomunk opened this issue Dec 10, 2020 · 3 comments
Labels
dif/medium Prior experience is likely helpful effort/days Estimated to take multiple days, but less than a week kind/enhancement A net-new feature or an improvement to an existing feature need/analysis Needs further analysis before proceeding P1 High: Likely tackled by core team if no one steps up topic/docs Documentation
Milestone

Comments

@teknomunk
Copy link

teknomunk commented Dec 10, 2020

As seen on this page, the response sections of every API call have no explanation of the returned fields. In one instance in particular, /api/v0/add, there is enough confusion about the Name and Hash fields to spawn a forum thread trying to determine what the Name field actually returns.

Proposed change:

  • Add text following each response JSON that detail what the responses are, expected values and similar information that would be useful to a developer using the API.
@lidel lidel transferred this issue from ipfs-inactive/http-api-docs Sep 21, 2021
@lidel lidel added the need/triage Needs initial labeling and prioritization label Sep 21, 2021
@johnnymatthews johnnymatthews changed the title No explanation of response fields Add the expected response for each API call. Sep 23, 2021
@johnnymatthews johnnymatthews added dif/medium Prior experience is likely helpful effort/days Estimated to take multiple days, but less than a week kind/enhancement A net-new feature or an improvement to an existing feature P1 High: Likely tackled by core team if no one steps up status/ready Ready to be worked topic/docs Documentation and removed need/triage Needs initial labeling and prioritization labels Sep 23, 2021
@johnnymatthews
Copy link
Collaborator

johnnymatthews commented Sep 23, 2021

We've recently added some automation tools to create the HTTP API docs every time there's a new Go-IPFS release. It might be possible to add in details of the responses of the API into this automation tooling.

@johnnymatthews johnnymatthews added need/analysis Needs further analysis before proceeding and removed status/ready Ready to be worked labels Sep 23, 2021
@ipfs ipfs deleted a comment from welcome bot Sep 23, 2021
@ipfs ipfs deleted a comment from welcome bot Sep 23, 2021
@johnnymatthews
Copy link
Collaborator

johnnymatthews commented Sep 23, 2021

So here's the deal: adding the details of each return value into the current automation processes we have is possible, but requires a very large PR and a bunch of effort. First, the returns fields have to be documented in the code. Then, the HTTP-DOCS-API (that now lives in ipfs-docs/tools) has to be updated to use Go reflect to parse out the comments and put them into the doc. I'm not saying that we shouldn't do this, we absolutely should; I'm just reflecting in the level of work that needs to go into the mentioned tools in order to close this issue. We likely need more discussion around this.

@lidel
Copy link
Member

lidel commented Sep 23, 2021

I agree, what is missing is providing the ./tools/http-docs-api generator with information about returned structures.

My 2 cents are that to ensure we have meaningful docs, this should be:

  • fully automated (no plaintext edited by humans – it always gets out fo date)
  • mandatory (required by the go-ipfs-cmds library)

Perhaps we could extend cmds.Command (go-ipfs-cmds) with a mandatory field that specifies format of response and then use golang's reflection to read that structure in http-docs-api generator and document --enc=json responses used on HTTP API?

I've added it to the maintenance board of Go stewards, could be a good tribute task (doable <1week).

@lidel lidel added this to Weekly Candidates in Maintenance Priorities - Go Sep 23, 2021
@lidel lidel changed the title Add the expected response for each API call. Document response formats for commands at /api/v0/ Sep 23, 2021
@BigLep BigLep removed this from Weekly Candidates in Maintenance Priorities - Go Mar 10, 2022
@BigLep BigLep added this to the TBD milestone Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dif/medium Prior experience is likely helpful effort/days Estimated to take multiple days, but less than a week kind/enhancement A net-new feature or an improvement to an existing feature need/analysis Needs further analysis before proceeding P1 High: Likely tackled by core team if no one steps up topic/docs Documentation
Projects
Status: No status
Development

No branches or pull requests

4 participants