A blueprint that generates documentation for Eve APIs in HTML and JSON formats. Eve-docs creates the documentation from your existing Eve configuration file, with no additional configuration required.
Clone this repo into your Eve application and modify your launch script to activate the blueprints:
from flask.ext.bootstrap import Bootstrap from eve_docs import eve_docs ... Bootstrap(app) app.register_blueprint(eve_docs, url_prefix='/docs')
After restarting, documentation is availabile at the url_prefix
defined in your launch script. example.py
shows how to do this using
the launch script from Nicola Iarocci's
eve-demo repo.
You may want to add descriptions for resources to eve-docs. This is possible by adding an additional key 'description' to the resource definition at the same level as the 'schema'. Inside the description, you can add 3 different types of additional documentation:
- 'general': A general description of the resource.
- 'methods': For each of the methods eve-docs lists, you can add a
method-related description.
- 'fields': You can add a description to each field of the schema.
An example of this additional description can be found in example.py for the 'people' resource:
'description': { 'general': 'Represents people who work at the company.', 'methods': { 'DELETE': 'DELETE may need special authorization.' }, 'fields': { 'role': 'The role defines the place of this person within the ' 'company', 'location': 'A dict for the address of this person.', 'born': 'Is datetime object, but only the date information is ' 'relevant.' } }
The HTML documentation is produced using the Flask-Bootstrap blueprint. Expand each domain to show available endpoint methods, and further expand each method to show parameter details. A screenshot with one method expanded follows, and you can also view a fully expanded example.
Documentation is also exposed as JSON at url_prefix/spec.json
for
programmatic consumption. Example output:
{ "base": "http://localhost:5000", "domains": { "people": { "/people/{_id}": { "GET": { "label": "Retrieve a person", "params": [ { "name": "_id", "type": "string", "required": true } ] ...
Released under the MIT License.