From 9ef5046e3a6a1e112740b706128152f211defcbd Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Oct 2025 10:25:37 +0000 Subject: [PATCH] Generate git --- services/git/src/stackit/git/models/instance.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/services/git/src/stackit/git/models/instance.py b/services/git/src/stackit/git/models/instance.py index 2d71925e8..e665b27a7 100644 --- a/services/git/src/stackit/git/models/instance.py +++ b/services/git/src/stackit/git/models/instance.py @@ -16,6 +16,7 @@ import json import pprint +import re # noqa: F401 from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set @@ -61,6 +62,19 @@ class Instance(BaseModel): "version", ] + @field_validator("created", mode="before") + def created_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + @field_validator("state") def state_validate_enum(cls, value): """Validates the enum"""