Skip to content

Commit 73cc783

Browse files
Copilotliudger
andcommitted
fix: use validation_alias instead of alias for data_type fields in EntityInfo
ty v0.0.33 improved pydantic model analysis and now correctly infers __init__ signatures. With alias=, the __init__ only accepts the alias parameter name (e.g. dataType), even when populate_by_name=True is set. Switching to validation_alias= keeps dataType accepted for JSON parsing while exposing the Python field name data_type as the __init__ parameter, which satisfies both ty's type checking and the existing tests. Agent-Logs-Url: https://github.com/liudger/python-bsblan/sessions/42f382e1-fe63-4644-8d29-ae0689a1c1b0 Co-authored-by: liudger <4112111+liudger@users.noreply.github.com>
1 parent ede9c2f commit 73cc783

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/bsblan/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,13 @@ class EntityInfo(BaseModel, Generic[T]):
326326
unit: str
327327
desc: str
328328
value: T | None = None
329-
data_type: int = Field(alias="dataType", default=0)
329+
data_type: int = Field(validation_alias="dataType", default=0)
330330
error: int = 0
331331
readonly: int = 0
332332
readwrite: int = 0
333333
precision: float | None = None
334-
data_type_name: str = Field(default="", alias="dataType_name")
335-
data_type_family: str = Field(default="", alias="dataType_family")
334+
data_type_name: str = Field(default="", validation_alias="dataType_name")
335+
data_type_family: str = Field(default="", validation_alias="dataType_family")
336336

337337
@model_validator(mode="before")
338338
@classmethod

0 commit comments

Comments
 (0)