Skip to content

Commit 2d3530f

Browse files
committed
fix: config default root models to allow new API fields
This doesn't automatically bring support for any intended functionality but in the case of informational model dumps, such as for the `skipped` info on a job pop or user/worker info responses this will allow some forwards compatibility in the case new fields are added to already known API models.
1 parent 7912776 commit 2d3530f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

horde_sdk/ai_horde_api/apimodels/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ class ImageGenerateParamMixin(HordeAPIDataObject):
199199
"""
200200

201201
model_config = (
202-
ConfigDict(frozen=True) if not os.getenv("TESTS_ONGOING") else ConfigDict(frozen=True, extra="forbid")
202+
ConfigDict(frozen=True, extra="allow")
203+
if not os.getenv("TESTS_ONGOING")
204+
else ConfigDict(frozen=True, extra="forbid")
203205
)
204206

205207
sampler_name: KNOWN_SAMPLERS | str = KNOWN_SAMPLERS.k_lms

horde_sdk/generic_api/apimodels.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class HordeAPIDataObject(BaseModel):
5858
ConfigDict(
5959
frozen=True,
6060
use_attribute_docstrings=True,
61+
extra="allow",
6162
)
6263
if not os.getenv("TESTS_ONGOING")
6364
else ConfigDict(
@@ -98,7 +99,9 @@ class HordeResponseBaseModel(HordeResponse, BaseModel):
9899
"""Base class for all Horde API response data models (leveraging pydantic)."""
99100

100101
model_config = (
101-
ConfigDict(frozen=True) if not os.getenv("TESTS_ONGOING") else ConfigDict(frozen=True, extra="forbid")
102+
ConfigDict(frozen=True, extra="allow")
103+
if not os.getenv("TESTS_ONGOING")
104+
else ConfigDict(frozen=True, extra="forbid")
102105
)
103106

104107

0 commit comments

Comments
 (0)