Skip to main content

os-api-ref

https://governance.openstack.org/tc/badges/os-api-ref Latest Version Downloads Typing Status

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 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

Metadata

Release files for os-api-ref 3.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for os-api-ref 3.2.0
File Size Uploaded
os_api_ref-3.2.0.tar.gz 90.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for os-api-ref 3.2.0
File Interpreter ABI Platform
os_api_ref-3.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 175.2 kB

Release files / os_api_ref-3.2.0.tar.gz

Download URL os_api_ref-3.2.0.tar.gz
Size 90.7 kB
Tags Source
SHA-256 checksum
How to use checksums
90bb7d8b601464ab03d8ad46ee083074f05a020772ab29c37abbbcb635b1dd14
BLAKE2b-256 checksum
How to use checksums
190a79170bb8fcb81238a905559069a19a6e47b1a6261512b67b2c9aaff807cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / os_api_ref-3.2.0-py3-none-any.whl

Download URL os_api_ref-3.2.0-py3-none-any.whl
Size 84.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73f3d51a0b66ff0e680f8570aee7e30cc178c7265e7402a8721f93defaa120d0
BLAKE2b-256 checksum
How to use checksums
c0a08c16e81c1e16ea36ced8de35bf41c95d84fd62aead1a48d0b8960d8221b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

3.2.0 This release

2 release files

3.1.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.4.0

2 release files

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page