From cf4b8226816c2c4badefbb3587083584f2658f83 Mon Sep 17 00:00:00 2001 From: "Anton.D" Date: Tue, 30 Dec 2025 17:08:28 +0100 Subject: [PATCH] update error message for query parameter type handling --- fastapi/dependencies/utils.py | 2 +- tests/test_invalid_sequence_param.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py index 5a19008c9..d918fe180 100644 --- a/fastapi/dependencies/utils.py +++ b/fastapi/dependencies/utils.py @@ -552,7 +552,7 @@ def analyze_param( # For Pydantic v1 and getattr(field, "shape", 1) == 1 ) - ), f"Query param {param_name!r} must be of one of the supported types" + ), f"Query parameter {param_name!r} must be one of the supported types" return ParamDetails(type_annotation=type_annotation, depends=depends, field=field) diff --git a/tests/test_invalid_sequence_param.py b/tests/test_invalid_sequence_param.py index ac5dcc121..3695344f7 100644 --- a/tests/test_invalid_sequence_param.py +++ b/tests/test_invalid_sequence_param.py @@ -8,7 +8,7 @@ from pydantic import BaseModel def test_invalid_sequence(): with pytest.raises( AssertionError, - match="Query param 'q' must be of one of the supported types", + match="Query parameter 'q' must be one of the supported types", ): app = FastAPI() @@ -23,7 +23,7 @@ def test_invalid_sequence(): def test_invalid_tuple(): with pytest.raises( AssertionError, - match="Query param 'q' must be of one of the supported types", + match="Query parameter 'q' must be one of the supported types", ): app = FastAPI() @@ -38,7 +38,7 @@ def test_invalid_tuple(): def test_invalid_dict(): with pytest.raises( AssertionError, - match="Query param 'q' must be of one of the supported types", + match="Query parameter 'q' must be one of the supported types", ): app = FastAPI() @@ -53,7 +53,7 @@ def test_invalid_dict(): def test_invalid_simple_dict(): with pytest.raises( AssertionError, - match="Query param 'q' must be of one of the supported types", + match="Query parameter 'q' must be one of the supported types", ): app = FastAPI()