ckanext-openapiviewer
ARCHIVED - This repository was archived by the owner on Nov 2, 2021. It is now read-only.
Overview
A BC Data Catalogue CKAN extension that renders resources of format ‘openapi-json’ in a Swagger Console. Uses swagger-ui 3.12.1 for displaying OpenAPI/Swagger specifications interactively.
Features
- Interactive Swagger console for API exploration
- Support for OpenAPI 3.x specifications
- BC Government customizations including:
- Authorization by corporate API keys
- GWA (API Gateway) integration
- ‘Try Example’ button for OAS 3 files
- ‘Manage API Keys’ functionality
- ‘API Key Help’ button
- Copy to clipboard and open request URL functionality
Installation
Using pip:
pip install ckanext-openapiviewer
Setup
Before this extension can be used, CKAN must have a resource format called ‘openapi-json’. You can create this via the CKAN API:
curl -X POST \
https://{your-ckan-domain}/api/3/action/vocabulary_create \
-H "authorization: {your-api-key}" \
-H "cache-control: no-cache" \
-H "content-type: application/x-www-form-urlencoded" \
-d "name=openapi-json"
Configuration
Add ‘openapi_view’ to ckan.plugins in your CKAN configuration.
Note
This extension has a dependency on the bcgov CKAN extension. The swagger-ui component is a customized version that includes BC Government-specific features for API key management and authorization.
License
MIT License