From 70cfd3de20fe8ba0313a2fac87ea1330c71e65b6 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Oct 2025 10:25:59 +0000 Subject: [PATCH] Generate objectstorage --- .../models/create_access_key_payload.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_access_key_payload.py b/services/objectstorage/src/stackit/objectstorage/models/create_access_key_payload.py index 2bbddfa11..521f6d0d3 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_access_key_payload.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_access_key_payload.py @@ -15,10 +15,11 @@ import json import pprint +import re # noqa: F401 from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, field_validator from typing_extensions import Self @@ -30,6 +31,19 @@ class CreateAccessKeyPayload(BaseModel): expires: Optional[datetime] = Field(default=None, description="Expiration date. Null means never expires.") __properties: ClassVar[List[str]] = ["expires"] + @field_validator("expires", mode="before") + def expires_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 + model_config = ConfigDict( populate_by_name=True, validate_assignment=True,