Skip to main content

This plugin provides an easy way to render a beautiful API reference based on a OpenAPI/Swagger file with FastAPI.

Project description

Scalar FastAPI API Reference Plugin

fastapi

Installation

pip install scalar-fastapi

Usage

FastAPI makes it super easy to enable scalar with their out of the box OpenAPI support

from fastapi import FastAPI
from scalar_fastapi import get_scalar_api_reference

app = FastAPI()

@app.get("/")
def read_root():
    return {"Hello": "World"}

@app.get("/scalar", include_in_schema=False)
async def scalar_html():
    return get_scalar_api_reference(
        openapi_url=app.openapi_url,
        title=app.title,
    )

Configuration

Currently available configuration options are listed below.

  • layout (default Layout.MODERN)
  • show_sidebar (defualt true)
  • hide_download_button (default false)
  • hide_models (default false)
  • dark_mode (default true)
  • search_hot_key (default SearchHotKey.K)
  • hidden_clients (default [])
  • servers (default [])
  • default_open_all_tags (default false)

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

scalar_fastapi-1.0.3.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

scalar_fastapi-1.0.3-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

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