Skip to content

Form example doesn't work properly; Errors and incorrect rendering in Swagger #11602

Discussion options

You must be logged in to vote

You're not using correctly Annonated, change to this:

from typing import Annotated

from fastapi import FastAPI, Form

app = FastAPI()


@app.post('/login')
def login(
        username: Annotated[str, Form()],
        password: Annotated[str, Form()],
):
    return {'username': username}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MasterGroosha
Comment options

Answer selected by MasterGroosha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
2 participants