Skip to content

Cannot parse configuration and theme info to FastAPI #4157

@raybesiga

Description

@raybesiga

What happens?

I installed Scalar FastAPI and setup the main.py as per the documentation

from typing import Union
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 + " - Scalar",
    )

It works perfectly fine with the default FastAPI theme. I then try to change the theme by adding the config variable as below:

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

It returns Internal Server Error. The Docker logs show:

 `TypeError: get_scalar_api_reference() got an unexpected keyword argument 'theme' 

What is the best way to add theme and configuration changes to Scalar for FastAPI?

What did you expect to happen?

I excepted Scalar to adopt the kepler theme for the documentation.

OpenAPI Document

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions