@ -246,9 +246,9 @@ So, when you need to declare a value as required while using `Query`, you can si
### Required, can be `None` { #required-can-be-none }
You might want to declare that a parameter can accept `None`, but is still required.
You might want to declare a parameter that can accept `None` but is still required.
However, because of how **HTTP query parameters** work, clients cannot actually send a real `None` (or `null`) value — query parameters are always sent as **strings**.
However, because of how **HTTP query parameters** work, clients cannot actually send a real `None` (or `null`) value - query parameters are always sent as **strings**.
That means you cannot truly have a *required* parameter that also allows a real `None` value.
But this will still expect a **string** value, and if the client omits `q` or tries to send `q=None`, FastAPI will raise a **request validation error**.
In other words, `None` is not an acceptable runtime value for query parameters — only strings are.
But this will still expect a **string** value, and if the client tries to send `q=None`, `q=null` or `q=`, these values will be treated by FastAPI as strings `"None"`, `"null"` and `""` (empty string) respectively.
If you want to accept special values (like `"None"` or an empty string) and interpret them as `None` in your application, you can handle them manually in your function:
This example uses `BeforeValidator`, which is only available in **Pydantic v2**.
///
## Query parameter list / multiple values { #query-parameter-list-multiple-values }
When you define a query parameter explicitly with `Query` you can also declare it to receive a list of values, or said in another way, to receive multiple values.