Skip to content

prefect.utilities.render_swagger

swagger_lib

Provides the actual swagger library used

Source code in prefect/utilities/render_swagger.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
def swagger_lib(config) -> dict:
    """
    Provides the actual swagger library used
    """
    lib_swagger = {
        "css": "https://unpkg.com/swagger-ui-dist@3/swagger-ui.css",
        "js": "https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js",
    }

    extra_javascript = config.get("extra_javascript", [])
    extra_css = config.get("extra_css", [])
    for lib in extra_javascript:
        if os.path.basename(urllib.parse.urlparse(lib).path) == "swagger-ui-bundle.js":
            lib_swagger["js"] = lib
            break

    for css in extra_css:
        if os.path.basename(urllib.parse.urlparse(css).path) == "swagger-ui.css":
            lib_swagger["css"] = css
            break
    return lib_swagger