Skip to content

Commit 1b708dd

Browse files
committed
Deserialization: Localization 'en' -> 'name.en'
1 parent 1334997 commit 1b708dd

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

data/examples/pretalx/submissions.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
"submission_type": "Talk (long session)",
2222
"submission_type_id": 3961,
2323
"track": {
24-
"en": "Software Engineering & Architecture"
24+
"name": {
25+
"en": "Software Engineering & Architecture"
26+
}
2527
},
2628
"track_id": 4493,
2729
"state": "confirmed",
@@ -137,7 +139,9 @@
137139
"submission_type": "Talk",
138140
"submission_type_id": 3961,
139141
"track": {
140-
"en": "PyData: LLMs"
142+
"name": {
143+
"en": "PyData: LLMs"
144+
}
141145
},
142146
"track_id": 4493,
143147
"state": "confirmed",

src/models/pretalx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PretalxSlot(BaseModel):
3333
@classmethod
3434
def handle_localized(cls, v) -> str | None:
3535
if isinstance(v, dict):
36-
return v.get("en")
36+
return v["name"].get("en")
3737
return v
3838

3939

@@ -77,7 +77,7 @@ class PretalxSubmission(BaseModel):
7777
@classmethod
7878
def handle_localized(cls, v) -> str | None:
7979
if isinstance(v, dict):
80-
return v.get("en")
80+
return v["name"].get("en")
8181
return v
8282

8383
@field_validator("duration", mode="before")

0 commit comments

Comments
 (0)