Skip to content

BC Data Catalogue extension for OpenAPI (AKA Swagger) console

License

Notifications You must be signed in to change notification settings

vrk-kpa/ckanext-openapiviewer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ckanext-openapi

This CKAN Extension creates an OpenAPI (aka Swagger) view that is accessible for previewing OpenAPI JSON resources.

  1. Pre-Installation

1.1 Create a new resource format in CKAN called 'openapi-json' using these instructions:

1.1.1. Get the id for resource_format:

GET /api/action/vocabulary_show?id=resource_format

The request should return a json object with id in result, you'll need the value associated with the id key.

1.1.2. Create a POST for tag_create:

POST /api/action/tag_create
Content-Type: application/json
Authorization: <user api key>

{
    "vocabulary_id": "<id value from the first step>",
    "name": "openapi-json"
}

If all goes well, the request should return something like this:

{
    "help": "http://10.1.0.2:5000/packages?ver=%2F1&name=tag_create&logic_function=help_show", 
    "success": true, 
    "result": {
        "vocabulary_id": "a42b7f16-b269-46c1-9464-98edc903fa81", 
        "packages": [], 
        "display_name": "openapi-json", 
        "id": "a3d45295-4fe8-4b64-8de0-d1e43e45a6e2", 
        "name": "openapi-json"
    }
}

Note: the openapi_view plugin is only be visible to resources with format of 'openapi-json'

  1. Installation

2.1 Copy ckanext-openapi into the ckan src folder

2.2. Within src/ckanext-openapi run:

python setup.py develop

2.3. Add 'openapi_view' to the list of plugins in your .ini file.

Note: If this extension is installed alongside ckanext-bcgov, be sure to list the 'openapi_view' plugin before the various 'edc' plugins in the .ini file.

If this extension is installed alongside pdf_view, be sure to list the 'openapi_view' plugin before pdf_view.

2.4. Add the new resource view to the CKAN database:

paster views create openapi_view -c INI_FILE

2.5. Startup ckan

About

BC Data Catalogue extension for OpenAPI (AKA Swagger) console

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 86.6%
  • Python 13.4%