Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for validates (0.12 sec)

  1. fastapi/openapi/models.py

                yield cls.validate
    
            @classmethod
            def validate(cls, v: Any) -> str:
                logger.warning(
                    "email-validator not installed, email fields will be treated as str.\n"
                    "To install, run: pip install email-validator"
                )
                return str(v)
    
            @classmethod
            def _validate(cls, __input_value: Any, _: Any) -> str:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 15.1K bytes
    - Viewed (0)
  2. pyproject.toml

        # For the test client
        "httpx >=0.23.0,<1.0.0",
        # For templates
        "jinja2 >=3.1.5",
        # For forms and file uploads
        "python-multipart >=0.0.18",
        # To validate email fields
        "email-validator >=2.0.0",
        # Uvicorn with uvloop
        "uvicorn[standard] >=0.12.0",
        # # Settings management
        "pydantic-settings >=2.0.0",
        # # Extra Pydantic data types
        "pydantic-extra-types >=2.0.0",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_security/test_tutorial005.py

        client = TestClient(mod.app)
        response = client.get("/users/me", headers={"Authorization": "Bearer nonexistent"})
        assert response.status_code == 401, response.text
        assert response.json() == {"detail": "Could not validate credentials"}
        assert response.headers["WWW-Authenticate"] == 'Bearer scope="me"'
    
    
    def test_incorrect_token_type(mod: ModuleType):
        client = TestClient(mod.app)
        response = client.get(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 15.8K bytes
    - Viewed (0)
  4. fastapi/_compat/__init__.py

    from .v2 import RequiredParam as RequiredParam
    from .v2 import Undefined as Undefined
    from .v2 import UndefinedType as UndefinedType
    from .v2 import Url as Url
    from .v2 import Validator as Validator
    from .v2 import _regenerate_error_with_loc as _regenerate_error_with_loc
    from .v2 import copy_field_info as copy_field_info
    from .v2 import create_body_model as create_body_model
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 2.2K bytes
    - Viewed (0)
  5. fastapi/datastructures.py

            """
            Close the file.
    
            To be awaitable, compatible with async, this is run in threadpool.
            """
            return await super().close()
    
        @classmethod
        def _validate(cls, __input_value: Any, _: Any) -> "UploadFile":
            if not isinstance(__input_value, StarletteUploadFile):
                raise ValueError(f"Expected UploadFile, received: {type(__input_value)}")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  6. fastapi/_compat/v2.py

                )
    
        def get_default(self) -> Any:
            if self.field_info.is_required():
                return Undefined
            return self.field_info.get_default(call_default_factory=True)
    
        def validate(
            self,
            value: Any,
            values: dict[str, Any] = {},  # noqa: B006
            *,
            loc: tuple[Union[int, str], ...] = (),
        ) -> tuple[Any, Union[list[dict[str, Any]], None]]:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 19.1K bytes
    - Viewed (0)
  7. fastapi/utils.py

        Union,
    )
    from weakref import WeakKeyDictionary
    
    import fastapi
    from fastapi._compat import (
        BaseConfig,
        ModelField,
        PydanticSchemaGenerationError,
        Undefined,
        UndefinedType,
        Validator,
        annotation_is_pydantic_v1,
    )
    from fastapi.datastructures import DefaultPlaceholder, DefaultType
    from fastapi.exceptions import FastAPIDeprecationWarning, PydanticV1NotSupportedError
    from pydantic import BaseModel
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  8. fastapi/dependencies/utils.py

        if value is None:
            if field.required:
                return None, [get_missing_field_error(loc=loc)]
            else:
                return deepcopy(field.default), []
        v_, errors_ = field.validate(value, values, loc=loc)
        if isinstance(errors_, list):
            new_errors = _regenerate_error_with_loc(errors=errors_, loc_prefix=())
            return None, new_errors
        else:
            return v_, []
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 37.6K bytes
    - Viewed (3)
  9. fastapi/routing.py

    ) -> Any:
        if field:
            errors = []
            if is_coroutine:
                value, errors_ = field.validate(response_content, {}, loc=("response",))
            else:
                value, errors_ = await run_in_threadpool(
                    field.validate, response_content, {}, loc=("response",)
                )
            if isinstance(errors_, list):
                errors.extend(errors_)
            if errors:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 174.6K bytes
    - Viewed (0)
  10. docs/en/docs/release-notes.md

    app = FastAPI()
    
    @app.get("/items/invalidnone", response_model=Union[Item, None])
    def get_invalid_none():
        return None
    ```
    
    This way the data will be correctly validated, you won't have an internal server error, and the documentation will also reflect that this *path operation* could return `None` (or `null` in JSON).
    
    ### Fixes
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 19:06:15 UTC 2025
    - 586.7K bytes
    - Viewed (0)
Back to top