Skip to content

Annotations being incorrectly squashed down #10

@Poogles

Description

@Poogles

I don't have a failing test for this yet but I'll try to put one together after lunch.

from typing import Annotated
from fastapi import Header

@app.get("/request")
@any_decorator
def request_method(
    requestor_id: Annotated[str, Header(alias="requestor_id")],
) -> bool:
    return True

Checking the signatures we get:

(Pdb) new_signature
<Signature (requestor_id: str) -> bool>
(Pdb) original_signature
<Signature (requestor_id: Annotated[str, Header(PydanticUndefined)]) -> bool>

This results in a 422 being thrown as FastAPI turns the string into a query string paramater requirement:

{'detail': [{'input': None, 'loc': ['query', 'requestor_id'], 'msg': 'Field required', 'type': 'missing'}]} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions