inveniosoftware / invenio-rest

REST API support for Invenio.
https://invenio-rest.readthedocs.io
MIT License
2 stars 41 forks source link

docs: API documentation tool #6

Open lnielsen opened 8 years ago

lnielsen commented 8 years ago

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

nharraud commented 8 years ago

tripit/slate

sphinxcontrib-httpdomain

@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 commented 8 years ago

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 commented 8 years ago

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

lnielsen commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 7 years ago

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

You can:

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 commented 7 years ago

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

kaplun commented 7 years ago

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

lnielsen commented 7 years ago

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 commented 7 years ago

@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