Coverage for backend/flowsheetInternals/formula_templates/template_schema.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-11-06 23:27 +0000

1from pydantic import BaseModel, Field 

2from core.auxiliary.enums import SimulationObjectClass 

3 

4 

5class TemplateFieldSchema(BaseModel): 

6 key: str = Field(..., description="Property key for this field") 

7 name: str = Field(..., description="Display name for this field") 

8 formula: str = Field(..., description="Formula for this field. This will be evaluated with sympy. Use [property_key] to refer to other properties on the same object.") 

9 

10 

11 

12class TemplateSchema(BaseModel): 

13 name: str 

14 fields: list[TemplateFieldSchema] 

15 required_properties: list[str] = Field(..., description="List of properties the simulation object must have to use this template") 

16