Skip to content

Commit

Permalink
fix(backend): Fix Pydantic default values
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Dec 2, 2024
1 parent 8cc2259 commit 727d3d4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions capella_model_explorer/backend/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def find_objects(model, obj_type=None, below=None, attr=None, filters=None):


class InstanceDetails(BaseModel):
idx: str = Field(..., title="Instance Identifier")
name: str = Field(..., title="Instance Name")
idx: str = Field(title="Instance Identifier")
name: str = Field(title="Instance Name")


class TemplateScope(BaseModel):
Expand All @@ -72,13 +72,13 @@ class TemplateScope(BaseModel):


class Template(BaseModel):
idx: str = Field(..., title="Template Identifier")
name: str = Field(..., title="Template Name")
template: Path = Field(..., title="Template File Path")
description: str = Field(..., title="Template Description")
idx: str = Field(title="Template Identifier")
name: str = Field(title="Template Name")
template: Path = Field(title="Template File Path")
description: str = Field(title="Template Description")

scope: TemplateScope | None = Field(
default_factory=dict, title="Template Scope"
scope: TemplateScope = Field(
default_factory=TemplateScope.model_construct, title="Template Scope"
)
single: bool | None = Field(None, title="Single Instance Flag")
isStable: bool | None = Field(None, title="Stable Template Flag")
Expand Down Expand Up @@ -121,7 +121,7 @@ def compute_instance_list(self, model: capellambse.MelodyModel):


class TemplateCategory(BaseModel):
idx: str = Field(..., title="Category Identifier")
idx: str = Field(title="Category Identifier")
templates: list[Template] = Field(
default_factory=list, title="Templates in this category"
)
Expand Down

0 comments on commit 727d3d4

Please sign in to comment.