From 4eb29506267cec07c7c9d45b569b951dfae61355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 14 Dec 2018 14:27:29 +0400 Subject: [PATCH] :bug: Fix error location for required parameters --- fastapi/dependencies/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py index 969acd3e6..d757f6b1f 100644 --- a/fastapi/dependencies/utils.py +++ b/fastapi/dependencies/utils.py @@ -249,16 +249,16 @@ def request_params_to_args( errors = [] for field in required_params: value = received_params.get(field.alias) + schema: params.Param = field.schema + assert isinstance(schema, params.Param), "Params must be subclasses of Param" if value is None: if field.required: errors.append( - ErrorWrapper(MissingError(), loc=field.alias, config=BaseConfig) + ErrorWrapper(MissingError(), loc=(schema.in_.value, field.alias), config=BaseConfig) ) else: values[field.name] = deepcopy(field.default) continue - schema: params.Param = field.schema - assert isinstance(schema, params.Param), "Params must be subclasses of Param" v_, errors_ = field.validate(value, values, loc=(schema.in_.value, field.alias)) if isinstance(errors_, ErrorWrapper): errors.append(errors_)