Fast API path parameters from Enum Class
The fact is that you need the LHS and RHS somewhere in your code, in some form. It can be a list, or dict, or in some other forms.
For example:
from enum import Enum
from fastapi import FastAPI

app = FastAPI()
some_dict = dict(
    path1=&quot;AcceptedEventRelation&quot;,
    path2=&quot;Account&quot;,
    path3=&quot;AccountChangeEvent&quot;,
    path4=&quot;AccountCleanInfo&quot;,
    path5=&quot;AccountContactRole&quot;
)

Subjects = Enum('Subjects', some_dict)


@app.get(&quot;/subjects/{sobjectname}&quot;)
async def process_subjects(sobjectname: Subjects):
    endpoint_subjects = &quot;/services/data/v49.0/sobjects&quot;
    url_to_request = endpoint_subjects + &quot;/&quot; + sobjectname.value
    return {
        &quot;subject&quot;: sobjectname,
        &quot;url_to_request&quot;: url_to_request
    }

Here, the some_dict is the variable you need to generate, which also looks ugly if there is a 100 items in it as the way you feel for the Enum class.