From 841db8a4ca81915bd16649168228e3a30f1e1cbe Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Mon, 11 May 2026 10:18:15 +0000 Subject: [PATCH] Generate objectstorage --- services/objectstorage/oas_commit | 2 +- .../src/stackit/objectstorage/api_client.py | 32 +++++++++---------- .../objectstorage/models/access_key.py | 7 ++-- .../stackit/objectstorage/models/bucket.py | 7 ++-- .../models/compliance_lock_response.py | 7 ++-- .../models/create_access_key_payload.py | 7 ++-- .../models/create_access_key_response.py | 7 ++-- .../models/create_bucket_response.py | 7 ++-- .../create_credentials_group_payload.py | 7 ++-- .../create_credentials_group_response.py | 7 ++-- .../objectstorage/models/credentials_group.py | 7 ++-- .../models/credentials_group_extended.py | 7 ++-- .../models/default_retention_response.py | 7 ++-- .../models/delete_access_key_response.py | 7 ++-- .../models/delete_bucket_response.py | 7 ++-- .../delete_credentials_group_response.py | 7 ++-- .../delete_default_retention_response.py | 7 ++-- .../objectstorage/models/detailed_error.py | 7 ++-- .../objectstorage/models/error_message.py | 7 ++-- .../models/get_bucket_response.py | 7 ++-- .../models/get_credentials_group_response.py | 7 ++-- .../models/http_validation_error.py | 7 ++-- .../models/list_access_keys_response.py | 7 ++-- .../models/list_buckets_response.py | 7 ++-- .../list_credentials_groups_response.py | 7 ++-- .../objectstorage/models/project_status.py | 7 ++-- .../models/set_default_retention_payload.py | 7 ++-- .../objectstorage/models/validation_error.py | 7 ++-- 28 files changed, 120 insertions(+), 96 deletions(-) diff --git a/services/objectstorage/oas_commit b/services/objectstorage/oas_commit index a978700c7..b129c2291 100644 --- a/services/objectstorage/oas_commit +++ b/services/objectstorage/oas_commit @@ -1 +1 @@ -467fe4d305e48699c34835e45fd1c7b486be01d2 +98c11e0ee4834ddaaa474eccc437d234e6276a70 diff --git a/services/objectstorage/src/stackit/objectstorage/api_client.py b/services/objectstorage/src/stackit/objectstorage/api_client.py index 0133d64f3..4f7c1585c 100644 --- a/services/objectstorage/src/stackit/objectstorage/api_client.py +++ b/services/objectstorage/src/stackit/objectstorage/api_client.py @@ -66,6 +66,7 @@ class ApiClient: "date": datetime.date, "datetime": datetime.datetime, "decimal": decimal.Decimal, + "UUID": uuid.UUID, "object": object, } _pool = None @@ -265,7 +266,7 @@ def response_deserialize( response_text = None return_data = None try: - if response_type == "bytearray": + if response_type in ("bytearray", "bytes"): return_data = response_data.data elif response_type == "file": return_data = self.__deserialize_file(response_data) @@ -326,25 +327,20 @@ def sanitize_for_serialization(self, obj): return obj.isoformat() elif isinstance(obj, decimal.Decimal): return str(obj) - elif isinstance(obj, dict): - obj_dict = obj + return {key: self.sanitize_for_serialization(val) for key, val in obj.items()} + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): + obj_dict = obj.to_dict() else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009 - obj_dict = obj.to_dict() - else: - obj_dict = obj.__dict__ - - if isinstance(obj_dict, list): - # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501 - return self.sanitize_for_serialization(obj_dict) + obj_dict = obj.__dict__ - return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} + return self.sanitize_for_serialization(obj_dict) def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. @@ -417,6 +413,8 @@ def __deserialize(self, data, klass): return self.__deserialize_datetime(data) elif klass is decimal.Decimal: return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: diff --git a/services/objectstorage/src/stackit/objectstorage/models/access_key.py b/services/objectstorage/src/stackit/objectstorage/models/access_key.py index 495316bde..69780a9f6 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/access_key.py +++ b/services/objectstorage/src/stackit/objectstorage/models/access_key.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -34,7 +35,8 @@ class AccessKey(BaseModel): __properties: ClassVar[List[str]] = ["displayName", "expires", "keyId"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/bucket.py b/services/objectstorage/src/stackit/objectstorage/models/bucket.py index 632bd707d..23d5c58c0 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/bucket.py +++ b/services/objectstorage/src/stackit/objectstorage/models/bucket.py @@ -24,6 +24,7 @@ StrictBool, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -44,7 +45,8 @@ class Bucket(BaseModel): __properties: ClassVar[List[str]] = ["name", "objectLockEnabled", "region", "urlPathStyle", "urlVirtualHostedStyle"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/compliance_lock_response.py b/services/objectstorage/src/stackit/objectstorage/models/compliance_lock_response.py index f628b9c37..974220d93 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/compliance_lock_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/compliance_lock_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class ComplianceLockResponse(BaseModel): __properties: ClassVar[List[str]] = ["maxRetentionDays", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: 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 521f6d0d3..5eb938d19 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 @@ -20,6 +20,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -45,7 +46,8 @@ def expires_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -56,8 +58,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_access_key_response.py b/services/objectstorage/src/stackit/objectstorage/models/create_access_key_response.py index bc49da76c..04c7690d2 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_access_key_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_access_key_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -37,7 +38,8 @@ class CreateAccessKeyResponse(BaseModel): __properties: ClassVar[List[str]] = ["accessKey", "displayName", "expires", "keyId", "project", "secretAccessKey"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_bucket_response.py b/services/objectstorage/src/stackit/objectstorage/models/create_bucket_response.py index e2ffc02f9..46d8ba7f0 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_bucket_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_bucket_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class CreateBucketResponse(BaseModel): __properties: ClassVar[List[str]] = ["bucket", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_payload.py b/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_payload.py index 0d106d562..f15b6b923 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_payload.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_payload.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -32,7 +33,8 @@ class CreateCredentialsGroupPayload(BaseModel): __properties: ClassVar[List[str]] = ["displayName"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_response.py b/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_response.py index 28357d6a0..8f5a00e2e 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.credentials_group import CredentialsGroup @@ -33,7 +34,8 @@ class CreateCredentialsGroupResponse(BaseModel): __properties: ClassVar[List[str]] = ["credentialsGroup", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/credentials_group.py b/services/objectstorage/src/stackit/objectstorage/models/credentials_group.py index 31e0c6988..39b3fff93 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/credentials_group.py +++ b/services/objectstorage/src/stackit/objectstorage/models/credentials_group.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -32,7 +33,8 @@ class CredentialsGroup(BaseModel): __properties: ClassVar[List[str]] = ["credentialsGroupId", "displayName", "urn"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/credentials_group_extended.py b/services/objectstorage/src/stackit/objectstorage/models/credentials_group_extended.py index 80dbb4308..a9b4554d3 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/credentials_group_extended.py +++ b/services/objectstorage/src/stackit/objectstorage/models/credentials_group_extended.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -33,7 +34,8 @@ class CredentialsGroupExtended(BaseModel): __properties: ClassVar[List[str]] = ["credentialsGroupId", "displayName", "urn", "userUrn"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/default_retention_response.py b/services/objectstorage/src/stackit/objectstorage/models/default_retention_response.py index c9346d084..00a27628a 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/default_retention_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/default_retention_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.retention_mode import RetentionMode @@ -35,7 +36,8 @@ class DefaultRetentionResponse(BaseModel): __properties: ClassVar[List[str]] = ["bucket", "days", "mode", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/delete_access_key_response.py b/services/objectstorage/src/stackit/objectstorage/models/delete_access_key_response.py index d99f2ee6d..6fd69ded5 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/delete_access_key_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/delete_access_key_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -33,7 +34,8 @@ class DeleteAccessKeyResponse(BaseModel): __properties: ClassVar[List[str]] = ["keyId", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/delete_bucket_response.py b/services/objectstorage/src/stackit/objectstorage/models/delete_bucket_response.py index f0021c509..20c747f2e 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/delete_bucket_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/delete_bucket_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class DeleteBucketResponse(BaseModel): __properties: ClassVar[List[str]] = ["bucket", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/delete_credentials_group_response.py b/services/objectstorage/src/stackit/objectstorage/models/delete_credentials_group_response.py index 9fe24e222..a42be15e7 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/delete_credentials_group_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/delete_credentials_group_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class DeleteCredentialsGroupResponse(BaseModel): __properties: ClassVar[List[str]] = ["credentialsGroupId", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/delete_default_retention_response.py b/services/objectstorage/src/stackit/objectstorage/models/delete_default_retention_response.py index 2c97baade..0565d1ca8 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/delete_default_retention_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/delete_default_retention_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class DeleteDefaultRetentionResponse(BaseModel): __properties: ClassVar[List[str]] = ["bucket", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/detailed_error.py b/services/objectstorage/src/stackit/objectstorage/models/detailed_error.py index 41d719031..12ee6fc1a 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/detailed_error.py +++ b/services/objectstorage/src/stackit/objectstorage/models/detailed_error.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class DetailedError(BaseModel): __properties: ClassVar[List[str]] = ["key", "msg"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/error_message.py b/services/objectstorage/src/stackit/objectstorage/models/error_message.py index 800cdcac6..9c26038bf 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/error_message.py +++ b/services/objectstorage/src/stackit/objectstorage/models/error_message.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.detailed_error import DetailedError @@ -32,7 +33,8 @@ class ErrorMessage(BaseModel): __properties: ClassVar[List[str]] = ["detail"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/get_bucket_response.py b/services/objectstorage/src/stackit/objectstorage/models/get_bucket_response.py index 7a8a47dfd..e25fa096a 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/get_bucket_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/get_bucket_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.bucket import Bucket @@ -33,7 +34,8 @@ class GetBucketResponse(BaseModel): __properties: ClassVar[List[str]] = ["bucket", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/get_credentials_group_response.py b/services/objectstorage/src/stackit/objectstorage/models/get_credentials_group_response.py index 1fc94f1d1..6bf65fd43 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/get_credentials_group_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/get_credentials_group_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.credentials_group_extended import ( @@ -35,7 +36,8 @@ class GetCredentialsGroupResponse(BaseModel): __properties: ClassVar[List[str]] = ["credentialsGroup", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/http_validation_error.py b/services/objectstorage/src/stackit/objectstorage/models/http_validation_error.py index 5593cafb1..808ca30f5 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/http_validation_error.py +++ b/services/objectstorage/src/stackit/objectstorage/models/http_validation_error.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.validation_error import ValidationError @@ -32,7 +33,8 @@ class HTTPValidationError(BaseModel): __properties: ClassVar[List[str]] = ["detail"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/list_access_keys_response.py b/services/objectstorage/src/stackit/objectstorage/models/list_access_keys_response.py index 16735896e..7383385a0 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/list_access_keys_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/list_access_keys_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.access_key import AccessKey @@ -33,7 +34,8 @@ class ListAccessKeysResponse(BaseModel): __properties: ClassVar[List[str]] = ["accessKeys", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/list_buckets_response.py b/services/objectstorage/src/stackit/objectstorage/models/list_buckets_response.py index f3b255788..0394ca0d2 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/list_buckets_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/list_buckets_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.bucket import Bucket @@ -33,7 +34,8 @@ class ListBucketsResponse(BaseModel): __properties: ClassVar[List[str]] = ["buckets", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/list_credentials_groups_response.py b/services/objectstorage/src/stackit/objectstorage/models/list_credentials_groups_response.py index d8ed3bd55..d32ba0e89 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/list_credentials_groups_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/list_credentials_groups_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.credentials_group import CredentialsGroup @@ -33,7 +34,8 @@ class ListCredentialsGroupsResponse(BaseModel): __properties: ClassVar[List[str]] = ["credentialsGroups", "project"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/project_status.py b/services/objectstorage/src/stackit/objectstorage/models/project_status.py index 9570ba9f3..30308e410 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/project_status.py +++ b/services/objectstorage/src/stackit/objectstorage/models/project_status.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.project_scope import ProjectScope @@ -33,7 +34,8 @@ class ProjectStatus(BaseModel): __properties: ClassVar[List[str]] = ["project", "scope"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/set_default_retention_payload.py b/services/objectstorage/src/stackit/objectstorage/models/set_default_retention_payload.py index 8105f5526..a331ac4f2 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/set_default_retention_payload.py +++ b/services/objectstorage/src/stackit/objectstorage/models/set_default_retention_payload.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.objectstorage.models.retention_mode import RetentionMode @@ -33,7 +34,8 @@ class SetDefaultRetentionPayload(BaseModel): __properties: ClassVar[List[str]] = ["days", "mode"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/objectstorage/src/stackit/objectstorage/models/validation_error.py b/services/objectstorage/src/stackit/objectstorage/models/validation_error.py index fc6bc8509..b698802e3 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/validation_error.py +++ b/services/objectstorage/src/stackit/objectstorage/models/validation_error.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.objectstorage.models.location_inner import LocationInner @@ -34,7 +35,8 @@ class ValidationError(BaseModel): __properties: ClassVar[List[str]] = ["loc", "msg", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: