Skip to main content

Swagger UI Application for Falcon

Project description

 PyPI 

Buy Me A Coffee

Simple Falcon application for adding Swagger UI to your falcon application.

Included Swagger UI version: v3.25.0

Installation

pip install falcon-swagger-ui

Usage

Example application:

import falcon
from falcon_swagger_ui import register_swaggerui_app

app = falcon.API()

SWAGGERUI_URL = '/swagger'  # without trailing slash
SCHEMA_URL = 'http://petstore.swagger.io/v2/swagger.json'

### For developer environment you can expose a static endpoint like:
# import pathlib
#
# SCHEMA_URL = '/static/v1/swagger.json'
# STATIC_PATH = pathlib.Path(__file__).parent / 'static'
#
# @see: http://falcon.readthedocs.io/en/stable/api/api.html#falcon.API.add_static_route
# app.add_static_route('/static', str(STATIC_PATH))
#

page_title = 'Falcon Swagger Doc'
favicon_url = 'https://falconframework.org/favicon-32x32.png'

register_swaggerui_app(
    app, SWAGGERUI_URL, SCHEMA_URL,
    page_title=page_title,
    favicon_url=favicon_url,
    config={'supportedSubmitMethods': ['get'], }
)

Running the example application:

pip install falcon gunicorn jinja2
gunicorn example:app

Configuration

The application supports overloading all Swagger UI configuration options that can be JSON serialized. See https://github.com/swagger-api/swagger-ui#parameters for options.

In addition, some of the OAuth fields are exposed to special variables that will be rendered into the relevant function.

Application defaults are listed below (should match SwaggerUI defaults).

{
        # OAuth related
        'app_name': 'null',
        'client_realm': 'null',
        'client_id': 'null',
        'client_secret': 'null',

        # SwaggerUI base configuration, see https://github.com/swagger-api/swagger-ui#parameters
        'docExpansion': "none",
        'jsonEditor': False,
        'defaultModelRendering': 'schema',
        'showRequestHeaders': False,
        'supportedSubmitMethods': ['get', 'post', 'put', 'delete', 'patch']
}

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

falcon-swagger-ui-1.2.0.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

falcon_swagger_ui-1.2.0-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

Details for the file falcon-swagger-ui-1.2.0.tar.gz.

File metadata

  • Download URL: falcon-swagger-ui-1.2.0.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for falcon-swagger-ui-1.2.0.tar.gz
Algorithm Hash digest
SHA256 100d111124b0283ea153049ba91fbaacfeae451193e23c98893f9ddb262b443f
MD5 5e5a7d912435f1f58d18c10eb75331f3
BLAKE2b-256 8b9e091dfce31a559b603b44d2df65195b6a568c9c9207a6145cb0405ac20b1f

See more details on using hashes here.

File details

Details for the file falcon_swagger_ui-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: falcon_swagger_ui-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for falcon_swagger_ui-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65374ec1b8fe8ac4ca0ec062c74f3c7929f7d3cb9c85392ab65e3f14c4ab3035
MD5 69c67f6934e87c7a9597b6a2020ecfff
BLAKE2b-256 aac69cae55b427a00d62e4a69440022ca32f33ca0b0ff4057b341bed726fb023

See more details on using hashes here.

Supported by

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