Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for _validate (0.06 sec)

  1. 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)
  2. 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)
  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. tests/test_tutorial/test_security/test_tutorial004.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"
    
    
    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: Fri Dec 26 10:43:02 UTC 2025
    - 13.3K bytes
    - Viewed (0)
  5. pyproject.toml

    standard = [
        "fastapi-cli[standard] >=0.0.8",
        # 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
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  6. tests/benchmarks/test_general_performance.py

        items: list[dict[str, Any]]
        metadata: dict[str, Any]
    
    
    class LargeOut(BaseModel):
        items: list[dict[str, Any]]
        metadata: dict[str, Any]
    
    
    app = FastAPI()
    
    
    @app.post("/sync/validated", response_model=ItemOut)
    def sync_validated(item: ItemIn, dep: Annotated[int, Depends(dep_b)]):
        return ItemOut(name=item.name, value=item.value, dep=dep)
    
    
    @app.get("/sync/dict-no-response-model")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 20:40:26 UTC 2025
    - 11.1K bytes
    - Viewed (0)
  7. 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)
  8. docs/en/docs/index.md

        * Swagger UI.
        * ReDoc.
    
    ---
    
    Coming back to the previous code example, **FastAPI** will:
    
    * Validate that there is an `item_id` in the path for `GET` and `PUT` requests.
    * Validate that the `item_id` is of type `int` for `GET` and `PUT` requests.
        * If it is not, the client will see a useful, clear error.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Dec 25 11:01:37 UTC 2025
    - 23.5K bytes
    - Viewed (0)
  9. 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)
  10. README.md

        * Swagger UI.
        * ReDoc.
    
    ---
    
    Coming back to the previous code example, **FastAPI** will:
    
    * Validate that there is an `item_id` in the path for `GET` and `PUT` requests.
    * Validate that the `item_id` is of type `int` for `GET` and `PUT` requests.
        * If it is not, the client will see a useful, clear error.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Dec 25 11:01:37 UTC 2025
    - 26.4K bytes
    - Viewed (0)
Back to top