From a9544929703a9d2e998faa1211e09c0643d48b0c Mon Sep 17 00:00:00 2001 From: Nisar k Date: Mon, 18 May 2026 10:42:13 +0000 Subject: [PATCH] docs: clarify required nullable query parameters --- .../en/docs/tutorial/query-params-str-validations.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/en/docs/tutorial/query-params-str-validations.md b/docs/en/docs/tutorial/query-params-str-validations.md index 4765b36cbe..e2764b16d1 100644 --- a/docs/en/docs/tutorial/query-params-str-validations.md +++ b/docs/en/docs/tutorial/query-params-str-validations.md @@ -222,7 +222,17 @@ 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 can declare that a parameter can accept `None`, but that it's still required. This would force clients to send a value, even if the value is `None`. +You can declare that a parameter can accept `None`, but that it's still required. + +This means that clients have to include the parameter in the request, even if its value could be `None` in the Python code. + +/// note + +Query parameters are sent in the URL, so they are normally strings. There isn't a standard way to send a Python `None` value in a query parameter. + +For example, omitting `q` would make the parameter missing, and sending `?q=` would send an empty string instead of `None`. + +/// To do that, you can declare that `None` is a valid type but simply do not declare a default value: