mirror of https://github.com/tiangolo/fastapi.git
fmt
This commit is contained in:
parent
19698b436d
commit
a19af62953
|
|
@ -640,7 +640,10 @@ async def solve_dependencies(
|
|||
)
|
||||
return values, errors, background_tasks, response, dependency_cache
|
||||
|
||||
class Marker: pass
|
||||
|
||||
class Marker:
|
||||
pass
|
||||
|
||||
|
||||
def request_params_to_args(
|
||||
required_params: Sequence[ModelField],
|
||||
|
|
@ -680,10 +683,10 @@ def request_params_to_args(
|
|||
if isinstance(errors_, ErrorWrapper):
|
||||
errors.append(errors_)
|
||||
elif (
|
||||
isinstance(errors_, list)
|
||||
and is_scalar_sequence_mapping_field(field)
|
||||
and isinstance(received_params, QueryParams)
|
||||
):
|
||||
isinstance(errors_, list)
|
||||
and is_scalar_sequence_mapping_field(field)
|
||||
and isinstance(received_params, QueryParams)
|
||||
):
|
||||
new_errors = _regenerate_error_with_loc(errors=errors_, loc_prefix=())
|
||||
# remove all invalid parameters
|
||||
marker = Marker()
|
||||
|
|
@ -693,9 +696,9 @@ def request_params_to_args(
|
|||
value[key] = [x for x in value[key] if x != marker]
|
||||
values[field.name] = value
|
||||
elif (
|
||||
isinstance(errors_, list)
|
||||
and is_scalar_mapping_field(field)
|
||||
and isinstance(received_params, QueryParams)
|
||||
isinstance(errors_, list)
|
||||
and is_scalar_mapping_field(field)
|
||||
and isinstance(received_params, QueryParams)
|
||||
):
|
||||
new_errors = _regenerate_error_with_loc(errors=errors_, loc_prefix=())
|
||||
# remove all invalid parameters
|
||||
|
|
|
|||
1472
test_openapi.json
1472
test_openapi.json
File diff suppressed because it is too large
Load Diff
|
|
@ -5,6 +5,7 @@ from fastapi import FastAPI, Path, Query
|
|||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.api_route("/api_route")
|
||||
def non_operation():
|
||||
return {"message": "Hello World"}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -425,7 +425,10 @@ def test_mapping_with_non_mapping_query():
|
|||
def test_mapping_with_non_mapping_query_mixed_types():
|
||||
response = client.get("/query/mixed-type-params/?foo=fuzz&foo=baz&bar=buzz&query=1")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == "foo bar 1 {'foo': 'baz', 'bar': 'buzz', 'query': '1'} {'query': '1'} {'foo': [], 'bar': [], 'query': ['1']}"
|
||||
assert (
|
||||
response.json()
|
||||
== "foo bar 1 {'foo': 'baz', 'bar': 'buzz', 'query': '1'} {'query': '1'} {'foo': [], 'bar': [], 'query': ['1']}"
|
||||
)
|
||||
|
||||
|
||||
def test_sequence_mapping_query():
|
||||
|
|
|
|||
Loading…
Reference in New Issue