Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for computed_field (0.05 sec)

  1. tests/test_computed_fields.py

        separate_input_output_schemas = request.param
        app = FastAPI(separate_input_output_schemas=separate_input_output_schemas)
    
        from pydantic import BaseModel, computed_field
    
        class Rectangle(BaseModel):
            width: int
            length: int
    
            @computed_field
            @property
            def area(self) -> int:
                return self.width * self.length
    
        @app.get("/")
        def read_root() -> Rectangle:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 3.2K bytes
    - Viewed (0)
  2. tests/test_openapi_separate_input_output_schemas.py

        sub: Optional[SubItem] = None
        model_config = {"json_schema_serialization_defaults_required": True}
    
    
    class WithComputedField(BaseModel):
        name: str
    
        @computed_field
        @property
        def computed_field(self) -> str:
            return f"computed {self.name}"
    
    
    def get_app_client(separate_input_output_schemas: bool = True) -> TestClient:
        app = FastAPI(separate_input_output_schemas=separate_input_output_schemas)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 26.6K bytes
    - Viewed (0)
  3. fastapi/_compat/v2.py

            # ModelField to its JSON Schema.
            return id(self)
    
    
    def _has_computed_fields(field: ModelField) -> bool:
        computed_fields = field._type_adapter.core_schema.get("schema", {}).get(
            "computed_fields", []
        )
        return len(computed_fields) > 0
    
    
    def get_schema_from_model_field(
        *,
        field: ModelField,
        model_name_map: ModelNameMap,
        field_mapping: dict[
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 19.1K bytes
    - Viewed (0)
  4. docs/en/docs/release-notes.md

    * 🐛 Fix using class (not instance) dependency that has `__call__` method. PR [#14458](https://github.com/fastapi/fastapi/pull/14458) by [@YuriiMotov](https://github.com/YuriiMotov).
    * 🐛 Fix `separate_input_output_schemas=False` with `computed_field`. PR [#14453](https://github.com/fastapi/fastapi/pull/14453) by [@YuriiMotov](https://github.com/YuriiMotov).
    
    ## 0.123.9
    
    ### 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