Skip to main content

falcon-swagger-ui

 PyPI 

Buy Me A Coffee

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

Included Swagger UI version: v3.38.0

Support Falcon 3.0.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']
}

Metadata

Release files for falcon-swagger-ui 1.2.2

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

Built distribution (wheel)

Table of built distributions (wheels) for falcon-swagger-ui 1.2.2
File Interpreter ABI Platform
falcon_swagger_ui-1.2.2-py3-none-any.whl Python 3 none any Details

Release files / falcon_swagger_ui-1.2.2-py3-none-any.whl

Download URL falcon_swagger_ui-1.2.2-py3-none-any.whl
Size 5.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
7fad8e44dc25db709a80afefcfaa2084387252fe87bef21dcb65f986ffcaa42e
BLAKE2b-256 checksum
How to use checksums
c0521955710f964f6e79d96f93229366926cc9d3a8bcc0b7e7ee47b72d2e6aa1
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.2.2 This release

1 release file

1.2.1

1 release file

1.2.0

2 release files

1.1.2

2 release files

1.1.1

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.0.8

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