Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 316 for declare (0.04 sec)

  1. docs/en/docs/tutorial/cookie-params.md

    ## Import `Cookie` { #import-cookie }
    
    First import `Cookie`:
    
    {* ../../docs_src/cookie_params/tutorial001_an_py310.py hl[3] *}
    
    ## Declare `Cookie` parameters { #declare-cookie-parameters }
    
    Then declare the cookie parameters using the same structure as with `Path` and `Query`.
    
    You can define the default value as well as all the extra validation or annotation parameters:
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 1.1K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/path-params-numeric-validations.md

    ///
    
    ## Declare metadata { #declare-metadata }
    
    You can declare all the same parameters as for `Query`.
    
    For example, to declare a `title` metadata value for the path parameter `item_id` you can type:
    
    {* ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py hl[10] *}
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 6.2K bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/query-params.md

    You can declare multiple path parameters and query parameters at the same time, **FastAPI** knows which is which.
    
    And you don't have to declare them in any specific order.
    
    They will be detected by name:
    
    {* ../../docs_src/query_params/tutorial004_py310.py hl[6,8] *}
    
    ## Required query parameters { #required-query-parameters }
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 10:29:01 UTC 2025
    - 4.5K bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/query-params-str-validations.md

    q: Annotated[str | None, Query(min_length=3)] = None
    ```
    
    ////
    
    So, when you need to declare a value as required while using `Query`, you can simply not declare a default value:
    
    {* ../../docs_src/query_params_str_validations/tutorial006_an_py39.py hl[9] *}
    
    ### Required, can be `None` { #required-can-be-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)
  5. docs/en/docs/tutorial/header-param-models.md

    This would allow you to **re-use the model** in **multiple places** and also to declare validations and metadata for all the parameters at once. 😎
    
    /// note
    
    This is supported since FastAPI version `0.115.0`. 🤓
    
    ///
    
    ## Header Parameters with a Pydantic Model { #header-parameters-with-a-pydantic-model }
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 2.6K bytes
    - Viewed (0)
  6. docs/en/docs/tutorial/body.md

    ```JSON
    {
        "name": "Foo",
        "price": 45.2
    }
    ```
    
    ## Declare it as a parameter { #declare-it-as-a-parameter }
    
    To add it to your *path operation*, declare it the same way you declared path and query parameters:
    
    {* ../../docs_src/body/tutorial001_py310.py hl[16] *}
    
    ...and declare its type as the model you created, `Item`.
    
    ## Results { #results }
    
    With just that Python type declaration, **FastAPI** will:
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 10:58:56 UTC 2025
    - 7.1K bytes
    - Viewed (0)
  7. docs/en/docs/advanced/security/oauth2-scopes.md

    ///
    
    {* ../../docs_src/security/tutorial005_an_py310.py hl[157] *}
    
    ## Declare scopes in *path operations* and dependencies { #declare-scopes-in-path-operations-and-dependencies }
    
    Now we declare that the *path operation* for `/users/me/items/` requires the scope `items`.
    
    For this, we import and use `Security` from `fastapi`.
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 10:49:48 UTC 2025
    - 13.5K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/request-form-models.md

    ///
    
    /// note
    
    This is supported since FastAPI version `0.113.0`. 🤓
    
    ///
    
    ## Pydantic Models for Forms { #pydantic-models-for-forms }
    
    You just need to declare a **Pydantic model** with the fields you want to receive as **form fields**, and then declare the parameter as `Form`:
    
    {* ../../docs_src/request_form_models/tutorial001_an_py39.py hl[9:11,15] *}
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 2.2K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/response-model.md

    /// tip
    
    If you have strict type checks in your editor, mypy, etc, you can declare the function return type as `Any`.
    
    That way you tell the editor that you are intentionally returning anything. But FastAPI will still do the data documentation, validation, filtering, etc. with the `response_model`.
    
    ///
    
    ### `response_model` Priority { #response-model-priority }
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 16K bytes
    - Viewed (0)
  10. docs/pt/docs/tutorial/header-params.md

    ## importe `Header`
    
    Primeiro importe `Header`:
    
    {* ../../docs_src/header_params/tutorial001_py310.py hl[1] *}
    
    ## Declare parâmetros de `Header`
    
    Então declare os paramêtros de cabeçalho usando a mesma estrutura que em `Path`, `Query` e `Cookie`.
    
    O primeiro valor é o valor padrão, você pode passar todas as validações adicionais ou parâmetros de anotação:
    
    Registered: Sun Sep 07 07:19:17 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 3.1K bytes
    - Viewed (0)
Back to top