django-apiblueprint-view
Render API Blueprints on-the-fly using Django templates
Installation
-
pip install django-apiblueprint-view -
Add to
INSTALLED_APPSin django settings:
INSTALLED_APPS = [
...
'apiblueprint_view',
]
Usage
from apiblueprint_view.views import ApiBlueprintView
urlpatterns = [
url(r'^docs/$', ApiBlueprintView.as_view(blueprint='/path/to/blueprint.apibp')),
]
Styling
Custom HTML Template
Define a custom base template. It must include the tag
{% include 'api_docs/docs_parent.html' %}
Pass it into ApiBlueprintView.as_view() as a parameter.
from apiblueprint_view.views import ApiBlueprintView
urlpatterns = [
url(r'^docs/$', ApiBlueprintView.as_view(
blueprint='/path/to/blueprint.apibp',
template_name='my_base_template.html'
)),
]
Custom CSS
ApiBlueprintView.as_view() may accept a styles dictionary describing custom CSS classes which should be attached to rendered HTML tags. For example:
from apiblueprint_view.views import ApiBlueprintView
urlpatterns = [
url(r'^docs/$', ApiBlueprintView.as_view(
blueprint='/path/to/blueprint.apibp',
template_name='my_base_template.html',
styles={
'action': {'class': 'foo bar'},
'method': {'class': 'baz'}
}
)),
]
The following keys are valid. All keys are optional:
'action': Container<div>for an API action'action_transaction': Container<div>for a HTTP transaction (request and response)'action_request': Container<div>for a HTTP request'action_response': Container<div>for a HTTP response'action_schema': Container<div>for a HTTP request or response schema'action_headers': Container<div>for HTTP request or response headers'action_body': Container<div>for a HTTP request or response body'action_example': Container<div>for an API action example URL'description': Container<div>for some text describing an action, resource, request, response, etc'parameters': Container<div>for a list of parameters'method': Generic<span>containing an HTTP method'method_CONNECT':<span>containing the textCONNECT'method_DELETE':<span>containing the textDELETE'method_GET':<span>containing the textGET'method_HEAD':<span>containing the textHEAD'method_OPTIONS':<span>containing the textOPTIONS'method_PATCH':<span>containing the textPATCH'method_POST':<span>containing the textPOST'method_PUT':<span>containing the textPUT'method_TRACE':<span>containing the textTRACE'resource': Container<div>for an API resource'resource_group': Container<div>for an API resource group
Highlight.js can be used to add syntax highlighting
Including Files
You can include other files in your blueprint by using an include directive with a path to the included file relative to the current file's directory. Included files can include other files, so be careful of circular references.
<!-- include(filename.md) -->
This syntax is not a part of the API Blueprint spec, but is also supported in some other tools e.g: aglio.
The include directive has the potential to introduce remote file inclusion or directory traversal vulnerabilities if your application renders user-supplied content. There are a couple of settings to help mitigate this. Set APIBP_PROCESS_INCLUDES = False in your django settings to completely ignore include directives (the default is True). There is also a whitelist of allowed file types to include. The default whitelist is ['.md', '.apibp', '.json'] but this can be overridden by setting APIBP_INCLUDE_WHITELIST to a list of allowed extensions in your django settings.
Metadata
Release files for django-apiblueprint-view 2.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_apiblueprint_view-2.5.0.tar.gz | 9.8 kB | Without provenance | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_apiblueprint_view-2.5.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| django_apiblueprint_view-2.5.0-py3-none-macosx_11_0_x86_64.whl | Python 3 | none | macOS 11.0+ x86-64 | Details |
Total release size: 1.7 MB
Release files / django_apiblueprint_view-2.5.0.tar.gz
| Download URL | django_apiblueprint_view-2.5.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56c849ac30e81ca6b8cf925b2c4ac85009dea85b6c5794f1d8d21556364b7239
|
|
BLAKE2b-256 checksum How to use checksums |
db132bdaa55f40af35f82f5da73390486095b2b46d97248870b8bce1fb743d92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / django_apiblueprint_view-2.5.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | django_apiblueprint_view-2.5.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
0911591fb2fede94e3a1d9080a8ad5d7167ae3cedb81b91678ae4381f5adba6d
|
|
BLAKE2b-256 checksum How to use checksums |
08f0d73fc7fdc9a7c03cd5058b3ab156cf6d346a1d51e09448b13ec9d1fc1d0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / django_apiblueprint_view-2.5.0-py3-none-macosx_11_0_x86_64.whl
| Download URL | django_apiblueprint_view-2.5.0-py3-none-macosx_11_0_x86_64.whl |
|---|---|
| Size | 466.6 kB |
| Tags | Python 3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
95bdaa8c4b05e5d58548c3a5ee8ad9a9e08a34ed56ff6bbd7869a1d1b63c071b
|
|
BLAKE2b-256 checksum How to use checksums |
c8d50d1d7bb9297dd8d69cf603fe69e3e12131d182ffb402edc5dc6f21678826
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for django-apiblueprint-view 2.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.