Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for computed_field (0.04 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)
Back to top