Skip to main content

Sphinx Extensions to support API reference sites in OpenStack

Project description

https://governance.openstack.org/tc/badges/os-api-ref.svg

os-api-ref

Sphinx Extensions to support API reference sites in OpenStack

This project is a collection of sphinx stanzas that assist in building an API Reference site for an OpenStack project in RST. RST is great for unstructured English, but displaying semi structured (and repetitive) data in tables is not its strength. This provides tooling to insert semi-structured data describing request and response parameters and status or error messages, and turn those into nice tables.

The project also includes a set of styling (and javascript) that is expected to layer on top of a Sphinx theme base. This addition provides a nice set of collapsing sections for REST methods and javascript controls to expand / collapse all sections.

Features

  • Sphinx stanza rest_method describing the method and resource for a REST API call. Lets authors write simply and also gives readers a clean way to scan all methods then click a button to get more information about a method.

  • Sphinx stanza rest_parameters used to insert semi-structured data into the RST files describing the parameters users can send with the request. The stanza points to a structured YAML file, parameters.yaml.

  • Sphinx stanza rest_status_code used to insert pointers to error or status codes returned by the service. Points to a structured YAML file, http_codes.yaml.

TODO

A list, in no particular order, of things we should do in this project. If you would like to contribute to any of these please show up in #openstack-dev on IRC and ask for sdague or mugsie to discuss or send an email to the openstack-discuss@lists.openstack.org list with [api] in the subject line.

  • Enhance documentation with more examples and best practices

  • Testing for the code

  • max_microversion parameter support - so that we automatically tag parameters that have been removed

  • Make a microversion selector, so that you can get a version of the api-ref that hides all microversion elements beyond your selected version (this one is going to be a bit of complex javascript), in progress.

Potential ideas

These aren’t even quite todos, but just ideas about things that might be useful.

  • .. literalinclude is good for API samples files to be included, but should we have more markup that includes the full REST /URL as well.

Sphinx stanzas

rest_method: Enter the REST method, such as GET, PUT, POST, DELETE, followed by the resource (not including an endpoint) for the call. For example:

.. rest_method:: PUT /v2/images/{image_id}/file

rest_parameters: Enter a reference to a parameters.yaml file and indicate which parameter you want to document. For example:

.. rest_parameters:: images-parameters.yaml

   - Content-type: Content-Type-data
   - image_id: image_id-in-path

Where the images-parameters.yaml file contains pointers named Content-type and image_id and descriptions for each.

rest_status_code: Enter a reference to a http-status.yaml file and indicate which errors or status codes you want to document. You can also add a pointer to more precise descriptions for each code. For example:

.. rest_status_code:: success http-codes.yaml

  - 204

.. rest_status_code:: error http-codes.yaml

  - 400: informal
  - 401
  - 403
  - 404
  - 409
  - 410: image-data-410
  - 413: image-data-413
  - 415: image-data-415
  - 500: informal
  - 503: image-data-503

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

os-api-ref-2.0.0.tar.gz (87.3 kB view details)

Uploaded Source

Built Distribution

os_api_ref-2.0.0-py3-none-any.whl (87.5 kB view details)

Uploaded Python 3

File details

Details for the file os-api-ref-2.0.0.tar.gz.

File metadata

  • Download URL: os-api-ref-2.0.0.tar.gz
  • Upload date:
  • Size: 87.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.5.2

File hashes

Hashes for os-api-ref-2.0.0.tar.gz
Algorithm Hash digest
SHA256 7cadd0d6eddeb7adf108ed9ae9739e0be0eb6149eb07a951f6ea0190ae13465f
MD5 8a016a0704146acd9203b713f5bad65c
BLAKE2b-256 cb46c64d106664269cd344fcb23ef42eaf0c3f9b1b16ad870e587a5e054db742

See more details on using hashes here.

Provenance

File details

Details for the file os_api_ref-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: os_api_ref-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 87.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.5.2

File hashes

Hashes for os_api_ref-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 744cfaf60dfaec626da79d03e2c161ecd8b57b31d79d6a289a1115dd3e57d7e5
MD5 f767a5bff01a5c8155df36a5d87ad846
BLAKE2b-256 32400d1ace6f6d2c0e80df260a199549d031e0337d40948dabfd8833cee347ca

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page