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

docs: API documentation tool #6

Open
lnielsen opened this issue Nov 1, 2015 · 11 comments
Open

docs: API documentation tool #6

lnielsen opened this issue Nov 1, 2015 · 11 comments

Comments

@lnielsen
Copy link
Member

lnielsen commented Nov 1, 2015

E.g. https://github.com/tripit/slate

@lnielsen lnielsen added this to the v1.0.0 milestone Nov 1, 2015
@nharraud
Copy link
Member

nharraud commented Nov 4, 2015

tripit/slate

  • Pros
    • Nice documentation, used by a lot of companies.
    • Markdown format even readable in Github
  • Cons
    • Very simple markdown format (also an advantage in some way). No syntax to specify error codes, parameters, etc... . This is for really high level doc with lots of examples.

sphinxcontrib-httpdomain

  • Pros
    • Quite complete syntax: request headers, query parameters, json body parameters...
    • Part of the documentation can be in the code and part outside, avoiding bloating the code with examples and at the same time avoiding duplication of doc in code and outside. claimstore example
  • Cons
    • It is possible to specify json parameters in the request body but I don't see any way to say that it's also valid for other formats (ex: xml)
    • Output is not as nice visually as tripit/slate.

@lnielsen @jirikuncar @tiborsimko
Just to be sure, what are the use-cases for this documentation?
1/ one doc per module containing a REST API
2/ helping services generate their own documentation by aggregating the doc from all rest apis registered on an app?

The main constraint is that we know that some modules will have more than just the REST API so we need a sphinx doc for the rest of the code.
Another constraint, if we go for multiple instances of one module api with different endpoints (as proposed here inveniosoftware/invenio-records-rest#9), is that we can't use the module documentation "as is" for the service api. The endpoints would not match.
What's more, as some services will have custom behavior depending on record metadata fields, (like we plan to do for B2Share), the service doc would be missing some important parts.

For module documentation I would use sphinxcontrib-httpdomain as we already use sphinx for the rest of the code, and leave services in charge of their own API documentation.

As the markdown format is simple, it might be possible to bootstrap a doc from the sphinx one if it is really needed, that way the endpoints would be valid. This could be done in a third-party module.

@lnielsen
Copy link
Member Author

lnielsen commented Nov 4, 2015

For my concern it's (2). Help services to create really good beautiful REST API documentation (which is critical for adoption of an API).

I don't think it will be possible to use auto-generated documentation, as it won't be specific enough for each instance.

@lnielsen
Copy link
Member Author

lnielsen commented Nov 4, 2015

If needed, we could do a invenio-rest-docs module where all this API documentation helpers exists.

@lnielsen
Copy link
Member Author

lnielsen commented Nov 4, 2015

Another points is that per service you might want a coherent view - e.g on Zenodo I won't not one REST API documentation but also integrate the OAI-PMH API documentation.

@nharraud
Copy link
Member

nharraud commented Nov 4, 2015

I'm not sure to follow. If we don't provide the services' API doc content, what would be providing invenio-rest-docs which would not be already in tripit/slate for example?

From the top of my head I can see one use case only: Helping the service developer make sure that their API has documented the last features provided by all invenio modules. It could be done automatically in travis/jenkins/younameit and does not imply generating the service's API doc.

@tiborsimko
Copy link
Member

For module documentation I would use sphinxcontrib-httpdomain as we already use sphinx for the rest of the code, and leave services in charge of their own API documentation. As the markdown format is simple, it might be possible to bootstrap a doc from the sphinx one if it is really needed

Seems interesting. The sphinx docs are good for the framework developers (the docs staying close to the code), the httpdomain extension does a good job for REST API semantics and formatting already, and if services are able to "collect" these docs for even prettier reformatting, then so much the better.

@hachreak
Copy link
Member

... and what about swagger? (now called OpenAPI Initiative )

You can:

  • document API in a YAML format
  • quickly write clients for many languages (e.g. for python)

You can have a look to an example of API description and a demo website that show documentation.
The Try it out is really interesting I think!

@jirikuncar
Copy link
Member

You can also watch a EP2016 talk about Flask-RESTPlus which is using Swagger UI (https://www.youtube.com/watch?v=OTWs0wPHU-g).

@kaplun
Copy link
Member

kaplun commented Aug 12, 2016

Also ORCID is using Swagger. https://pub.orcid.org/v2.0_rc1/

@lnielsen
Copy link
Member Author

Personally I really dislike Swagger style of documentation compared to the style from e.g. slate.

Btw, there's also e.g. http://jsonapi.org when we talk about standards.

@MikeRalphson
Copy link

@lnielsen I have written up a comparison of four tools which can convert OpenAPI / Swagger definitions into Slate-compatible markdown, in case it's of any interest?

There's also a more Slate-like theme for Swagger-UI here

@lnielsen lnielsen modified the milestones: someday, v1.0.0 Feb 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants