From aaf6f48c02a09afd9e59ba1f8719491c69eabaa1 Mon Sep 17 00:00:00 2001 From: Victor Skvortsov Date: Thu, 4 Sep 2025 14:43:47 +0500 Subject: [PATCH] Exclude target when equal to min for responses --- src/dstack/_internal/core/models/fleets.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dstack/_internal/core/models/fleets.py b/src/dstack/_internal/core/models/fleets.py index 7d7d31aa8a..0bb3103b47 100644 --- a/src/dstack/_internal/core/models/fleets.py +++ b/src/dstack/_internal/core/models/fleets.py @@ -163,6 +163,15 @@ class FleetNodesSpec(CoreModel): ), ] = None + def dict(self, *args, **kwargs) -> Dict: + # super() does not work with pydantic-duality + res = CoreModel.dict(self, *args, **kwargs) + # For backward compatibility with old clients + # that do not ignore extra fields due to https://github.com/dstackai/dstack/issues/3066 + if hasattr(res, "target") and res["target"] == res["min"]: + del res["target"] + return res + @root_validator(pre=True) def set_min_and_target_defaults(cls, values): min_ = values.get("min")