- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 64 for declaring (0.07 sec)
-
docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
In some cases you don't really need the return value of a dependency inside your *path operation function*. Or the dependency doesn't return a value. But you still need it to be executed/solved. For those cases, instead of declaring a *path operation function* parameter with `Depends`, you can add a `list` of `dependencies` to the *path operation decorator*.
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 2.9K bytes - Viewed (0) -
docs/en/docs/tutorial/dependencies/sub-dependencies.md
## Use the dependency { #use-the-dependency } Then we can use the dependency with: {* ../../docs_src/dependencies/tutorial005_an_py310.py hl[23] *} /// info Notice that we are only declaring one dependency in the *path operation function*, the `query_or_cookie_extractor`. But **FastAPI** will know that it has to solve `query_extractor` first, to pass the results of that to `query_or_cookie_extractor` while calling it.
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 3.7K bytes - Viewed (0) -
docs/en/docs/advanced/templates.md
Also, before that, in previous versions, the `request` object was passed as part of the key-value pairs in the context for Jinja2. /// /// tip By declaring `response_class=HTMLResponse` the docs UI will be able to know that the response will be HTML. /// /// note | Technical Details You could also use `from starlette.templating import Jinja2Templates`.
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 3.5K bytes - Viewed (0) -
docs/en/docs/tutorial/response-status-code.md
Changing the default { #changing-the-default } Later, in the [Advanced User Guide](../advanced/response-change-status-code.md){.internal-link target=_blank}, you will see how to return a different status code than the default you are declaring here....
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 4K bytes - Viewed (0) -
docs/en/docs/advanced/openapi-webhooks.md
/// info The `app.webhooks` object is actually just an `APIRouter`, the same type you would use when structuring your app with multiple files. /// Notice that with webhooks you are actually not declaring a *path* (like `/items/`), the text you pass there is just an **identifier** of the webhook (the name of the event), for example in `@app.webhooks.post("new-subscription")`, the webhook name is `new-subscription`.
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 2.9K bytes - Viewed (0) -
docs/en/docs/tutorial/query-params-str-validations.md
When we don't need to declare more validations or metadata, we can make the `q` query parameter required just by not declaring a default value, like: ```Python q: str ``` instead of: ```Python q: str | None = None ``` But we are now declaring it with `Query`, for example like: //// tab | Annotated ```Python q: Annotated[str | None, Query(min_length=3)] = None ```
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 17.2K bytes - Viewed (0) -
docs/en/docs/tutorial/dependencies/classes-as-dependencies.md
/// ```Python commons = Depends(CommonQueryParams) ``` //// ...as in: {* ../../docs_src/dependencies/tutorial003_an_py310.py hl[19] *} But declaring the type is encouraged as that way your editor will know what will be passed as the parameter `commons`, and then it can help you with code completion, type checks, etc: <img src="/img/tutorial/dependencies/image02.png">
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 6.7K bytes - Viewed (0) -
docs/en/docs/advanced/path-operation-advanced-configuration.md
For example, in this application we don't use FastAPI's integrated functionality to extract the JSON Schema from Pydantic models nor the automatic validation for JSON. In fact, we are declaring the request content type as YAML, not JSON: //// tab | Pydantic v2 {* ../../docs_src/path_operation_advanced_configuration/tutorial007.py hl[17:22, 24] *} //// //// tab | Pydantic v1
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 7.8K bytes - Viewed (0) -
docs/en/docs/tutorial/extra-models.md
{* ../../docs_src/extra_models/tutorial004_py39.py hl[18] *} ## Response with arbitrary `dict` { #response-with-arbitrary-dict } You can also declare a response using a plain arbitrary `dict`, declaring just the type of the keys and values, without using a Pydantic model. This is useful if you don't know the valid field/attribute names (that would be needed for a Pydantic model) beforehand.
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 7.2K bytes - Viewed (0) -
docs/en/docs/tutorial/body.md
Then you declare your data model as a class that inherits from `BaseModel`. Use standard Python types for all the attributes: {* ../../docs_src/body/tutorial001_py310.py hl[5:9] *} The same as when declaring query parameters, when a model attribute has a default value, it is not required. Otherwise, it is required. Use `None` to make it just optional. For example, this model above declares a JSON "`object`" (or Python `dict`) like:
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 10:58:56 UTC 2025 - 7.1K bytes - Viewed (0)