Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for explicitly (0.56 sec)

  1. docs/en/docs/advanced/dataclasses.md

    So, even with the code above that doesn't use Pydantic explicitly, FastAPI is using Pydantic to convert those standard dataclasses to Pydantic's own flavor of dataclasses.
    
    And of course, it supports the same:
    
    * data validation
    * data serialization
    * data documentation, etc.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/response-model.md

        "tax": 10.5,
        "tags": []
    }
    ```
    
    FastAPI is smart enough (actually, Pydantic is smart enough) to realize that, even though `description`, `tax`, and `tags` have the same values as the defaults, they were set explicitly (instead of taken from the defaults).
    
    So, they will be included in the JSON response.
    
    !!! tip
        Notice that the default values can be anything, not only `None`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17.9K bytes
    - Viewed (0)
  3. docs/en/docs/advanced/sub-applications.md

    And the sub-application could also have its own mounted sub-applications and everything would work correctly, because FastAPI handles all these `root_path`s automatically.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 2.9K bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/body-multiple-params.md

    Of course, you can also declare additional query parameters whenever you need, additional to any body parameters.
    
    As, by default, singular values are interpreted as query parameters, you don't have to explicitly add a `Query`, you can just do:
    
    ```Python
    q: Union[str, None] = None
    ```
    
    Or in Python 3.10 and above:
    
    ```Python
    q: str | None = None
    ```
    
    For example:
    
    === "Python 3.10+"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 7.7K bytes
    - Viewed (0)
  5. pyproject.toml

        'ignore:datetime\.datetime\.utcfromtimestamp\(\) is deprecated and scheduled for removal in a future version\..*:DeprecationWarning:sqlalchemy',
        # TODO: remove after upgrading python-jose to a version that explicitly supports Python 3.12
        # also, if it won't receive an update, consider replacing python-jose with some alternative
        # related issues:
        #   - https://github.com/mpdavis/python-jose/issues/332
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  6. docs/en/docs/tutorial/cors.md

    But that will only allow certain types of communication, excluding everything that involves credentials: Cookies, Authorization headers like those used with Bearer Tokens, etc.
    
    So, for everything to work correctly, it's better to specify explicitly the allowed origins.
    
    ## Use `CORSMiddleware`
    
    You can configure it in your **FastAPI** application using the `CORSMiddleware`.
    
    * Import `CORSMiddleware`.
    * Create a list of allowed origins (as strings).
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Nov 13 20:28:37 GMT 2022
    - 5.1K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/query-params-str-validations.md

    ```Python
    q: str | None = Query(default=None)
    ```
    
    ...makes the parameter optional, with a default value of `None`, the same as:
    
    ```Python
    q: str | None = None
    ```
    
    But it declares it explicitly as being a query parameter.
    
    !!! info
        Keep in mind that the most important part to make a parameter optional is the part:
    
        ```Python
        = None
        ```
    
        or the:
    
        ```Python
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 25.7K bytes
    - Viewed (0)
  8. fastapi/encoders.py

            bool,
            Doc(
                """
                Pydantic's `exclude_unset` parameter, passed to Pydantic models to define
                if it should exclude from the output the fields that were not explicitly
                set (and that only had their default values).
                """
            ),
        ] = False,
        exclude_defaults: Annotated[
            bool,
            Doc(
                """
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_body/test_tutorial001_py310.py

                        "msg": "value is not a valid dict",
                        "type": "type_error.dict",
                    }
                ]
            }
        )
    
    
    @needs_py310
    def test_explicit_content_type(client: TestClient):
        response = client.post(
            "/items/",
            content='{"name": "Foo", "price": 50.5}',
            headers={"Content-Type": "application/json"},
        )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 15K bytes
    - Viewed (2)
  10. tests/test_tutorial/test_body/test_tutorial001.py

                        "loc": ["body"],
                        "msg": "value is not a valid dict",
                        "type": "type_error.dict",
                    }
                ]
            }
        )
    
    
    def test_explicit_content_type(client: TestClient):
        response = client.post(
            "/items/",
            content='{"name": "Foo", "price": 50.5}',
            headers={"Content-Type": "application/json"},
        )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 14.7K bytes
    - Viewed (7)
Back to top