diff --git a/services/dns/oas_commit b/services/dns/oas_commit index e3713dde3..f4a2ce25c 100644 --- a/services/dns/oas_commit +++ b/services/dns/oas_commit @@ -1 +1 @@ -0e64886dd0847341800d7191ed193b75413be998 +8f43ed707da765654e4427642c9d978f80d504e1 diff --git a/services/dns/src/stackit/dns/api_client.py b/services/dns/src/stackit/dns/api_client.py index 62ff9367c..b7efe9e2f 100644 --- a/services/dns/src/stackit/dns/api_client.py +++ b/services/dns/src/stackit/dns/api_client.py @@ -67,6 +67,7 @@ class ApiClient: "date": datetime.date, "datetime": datetime.datetime, "decimal": decimal.Decimal, + "UUID": uuid.UUID, "object": object, } _pool = None @@ -266,7 +267,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) @@ -327,25 +328,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")): # noqa: B009 + 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. @@ -418,6 +414,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/dns/src/stackit/dns/models/clone_zone_payload.py b/services/dns/src/stackit/dns/models/clone_zone_payload.py index 5820d2a08..f3e94150e 100644 --- a/services/dns/src/stackit/dns/models/clone_zone_payload.py +++ b/services/dns/src/stackit/dns/models/clone_zone_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictBool +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -45,7 +46,8 @@ class CloneZonePayload(BaseModel): __properties: ClassVar[List[str]] = ["adjustRecords", "description", "dnsName", "name"] 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/dns/src/stackit/dns/models/create_label_payload.py b/services/dns/src/stackit/dns/models/create_label_payload.py index d8f5e1fbb..dc7957bda 100644 --- a/services/dns/src/stackit/dns/models/create_label_payload.py +++ b/services/dns/src/stackit/dns/models/create_label_payload.py @@ -19,6 +19,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 CreateLabelPayload(BaseModel): __properties: ClassVar[List[str]] = ["key", "value"] 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/dns/src/stackit/dns/models/create_label_response.py b/services/dns/src/stackit/dns/models/create_label_response.py index fa37b36fb..2a8a02739 100644 --- a/services/dns/src/stackit/dns/models/create_label_response.py +++ b/services/dns/src/stackit/dns/models/create_label_response.py @@ -19,6 +19,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.dns.models.label import Label @@ -34,7 +35,8 @@ class CreateLabelResponse(BaseModel): __properties: ClassVar[List[str]] = ["label", "message"] 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/dns/src/stackit/dns/models/create_record_set_payload.py b/services/dns/src/stackit/dns/models/create_record_set_payload.py index efadaca3a..1ac7eca65 100644 --- a/services/dns/src/stackit/dns/models/create_record_set_payload.py +++ b/services/dns/src/stackit/dns/models/create_record_set_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.dns.models.record_payload import RecordPayload @@ -80,7 +81,8 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -91,8 +93,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/dns/src/stackit/dns/models/create_zone_payload.py b/services/dns/src/stackit/dns/models/create_zone_payload.py index d5e617525..c26a15277 100644 --- a/services/dns/src/stackit/dns/models/create_zone_payload.py +++ b/services/dns/src/stackit/dns/models/create_zone_payload.py @@ -26,6 +26,7 @@ StrictStr, field_validator, ) +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.dns.models.zone_extensions import ZoneExtensions @@ -98,7 +99,8 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -109,8 +111,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/dns/src/stackit/dns/models/delete_label_response.py b/services/dns/src/stackit/dns/models/delete_label_response.py index 18f28d2ac..9ce9dd155 100644 --- a/services/dns/src/stackit/dns/models/delete_label_response.py +++ b/services/dns/src/stackit/dns/models/delete_label_response.py @@ -19,6 +19,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.dns.models.label import Label @@ -34,7 +35,8 @@ class DeleteLabelResponse(BaseModel): __properties: ClassVar[List[str]] = ["label", "message"] 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/dns/src/stackit/dns/models/domain_extensions.py b/services/dns/src/stackit/dns/models/domain_extensions.py index 8e62e4834..8a46b50a6 100644 --- a/services/dns/src/stackit/dns/models/domain_extensions.py +++ b/services/dns/src/stackit/dns/models/domain_extensions.py @@ -19,6 +19,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 Self from stackit.dns.models.domain_observability_extension import ( @@ -37,7 +38,8 @@ class DomainExtensions(BaseModel): __properties: ClassVar[List[str]] = ["observabilityExtension"] 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/dns/src/stackit/dns/models/domain_observability_extension.py b/services/dns/src/stackit/dns/models/domain_observability_extension.py index c88d5f119..06c9e3a48 100644 --- a/services/dns/src/stackit/dns/models/domain_observability_extension.py +++ b/services/dns/src/stackit/dns/models/domain_observability_extension.py @@ -19,6 +19,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 DomainObservabilityExtension(BaseModel): __properties: ClassVar[List[str]] = ["observabilityInstanceId", "state"] 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/dns/src/stackit/dns/models/error_message.py b/services/dns/src/stackit/dns/models/error_message.py index 6a77fb404..392ef7d45 100644 --- a/services/dns/src/stackit/dns/models/error_message.py +++ b/services/dns/src/stackit/dns/models/error_message.py @@ -19,6 +19,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 @@ -32,7 +33,8 @@ class ErrorMessage(BaseModel): __properties: ClassVar[List[str]] = ["error", "message"] 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/dns/src/stackit/dns/models/export_record_sets_payload.py b/services/dns/src/stackit/dns/models/export_record_sets_payload.py index a41fd7ce5..35c7e3f6a 100644 --- a/services/dns/src/stackit/dns/models/export_record_sets_payload.py +++ b/services/dns/src/stackit/dns/models/export_record_sets_payload.py @@ -26,6 +26,7 @@ StrictStr, field_validator, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -49,7 +50,8 @@ def format_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -60,8 +62,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/dns/src/stackit/dns/models/import_record_sets_payload.py b/services/dns/src/stackit/dns/models/import_record_sets_payload.py index 031165514..24264f8af 100644 --- a/services/dns/src/stackit/dns/models/import_record_sets_payload.py +++ b/services/dns/src/stackit/dns/models/import_record_sets_payload.py @@ -19,6 +19,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 Self from stackit.dns.models.zone_models_import_record_model import ( @@ -35,7 +36,8 @@ class ImportRecordSetsPayload(BaseModel): __properties: ClassVar[List[str]] = ["rrSets"] 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/dns/src/stackit/dns/models/import_record_sets_response.py b/services/dns/src/stackit/dns/models/import_record_sets_response.py index 7b886c933..3e2249d02 100644 --- a/services/dns/src/stackit/dns/models/import_record_sets_response.py +++ b/services/dns/src/stackit/dns/models/import_record_sets_response.py @@ -19,6 +19,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.dns.models.import_summary import ImportSummary @@ -34,7 +35,8 @@ class ImportRecordSetsResponse(BaseModel): __properties: ClassVar[List[str]] = ["message", "summary"] 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/dns/src/stackit/dns/models/import_summary.py b/services/dns/src/stackit/dns/models/import_summary.py index 8be19baa5..d3240b4de 100644 --- a/services/dns/src/stackit/dns/models/import_summary.py +++ b/services/dns/src/stackit/dns/models/import_summary.py @@ -19,6 +19,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 @@ -55,7 +56,8 @@ class ImportSummary(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -66,8 +68,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/dns/src/stackit/dns/models/label.py b/services/dns/src/stackit/dns/models/label.py index 76421a4fc..bcad10321 100644 --- a/services/dns/src/stackit/dns/models/label.py +++ b/services/dns/src/stackit/dns/models/label.py @@ -19,6 +19,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 Label(BaseModel): __properties: ClassVar[List[str]] = ["key", "value"] 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/dns/src/stackit/dns/models/list_labels_response.py b/services/dns/src/stackit/dns/models/list_labels_response.py index 6f2440f2d..4b0486aec 100644 --- a/services/dns/src/stackit/dns/models/list_labels_response.py +++ b/services/dns/src/stackit/dns/models/list_labels_response.py @@ -19,6 +19,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.dns.models.label import Label @@ -34,7 +35,8 @@ class ListLabelsResponse(BaseModel): __properties: ClassVar[List[str]] = ["labels", "message"] 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/dns/src/stackit/dns/models/list_record_sets_response.py b/services/dns/src/stackit/dns/models/list_record_sets_response.py index 36ea48e6c..1a277d750 100644 --- a/services/dns/src/stackit/dns/models/list_record_sets_response.py +++ b/services/dns/src/stackit/dns/models/list_record_sets_response.py @@ -19,6 +19,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.dns.models.record_set import RecordSet @@ -37,7 +38,8 @@ class ListRecordSetsResponse(BaseModel): __properties: ClassVar[List[str]] = ["itemsPerPage", "message", "rrSets", "totalItems", "totalPages"] 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/dns/src/stackit/dns/models/list_zones_response.py b/services/dns/src/stackit/dns/models/list_zones_response.py index 6c22da3c4..d1e6152ac 100644 --- a/services/dns/src/stackit/dns/models/list_zones_response.py +++ b/services/dns/src/stackit/dns/models/list_zones_response.py @@ -19,6 +19,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.dns.models.zone import Zone @@ -37,7 +38,8 @@ class ListZonesResponse(BaseModel): __properties: ClassVar[List[str]] = ["itemsPerPage", "message", "totalItems", "totalPages", "zones"] 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/dns/src/stackit/dns/models/message.py b/services/dns/src/stackit/dns/models/message.py index 17aaacf07..70d46718d 100644 --- a/services/dns/src/stackit/dns/models/message.py +++ b/services/dns/src/stackit/dns/models/message.py @@ -19,6 +19,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 Message(BaseModel): __properties: ClassVar[List[str]] = ["message"] 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/dns/src/stackit/dns/models/move_code_response.py b/services/dns/src/stackit/dns/models/move_code_response.py index a6a6fdc2f..9b7b1be4b 100644 --- a/services/dns/src/stackit/dns/models/move_code_response.py +++ b/services/dns/src/stackit/dns/models/move_code_response.py @@ -19,6 +19,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 MoveCodeResponse(BaseModel): __properties: ClassVar[List[str]] = ["code", "expiresAt", "message"] 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/dns/src/stackit/dns/models/move_zone_payload.py b/services/dns/src/stackit/dns/models/move_zone_payload.py index 1937968be..3998ef98a 100644 --- a/services/dns/src/stackit/dns/models/move_zone_payload.py +++ b/services/dns/src/stackit/dns/models/move_zone_payload.py @@ -19,6 +19,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 @@ -36,7 +37,8 @@ class MoveZonePayload(BaseModel): __properties: ClassVar[List[str]] = ["code", "zoneDnsName"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,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/dns/src/stackit/dns/models/partial_update_record_payload.py b/services/dns/src/stackit/dns/models/partial_update_record_payload.py index 633710fcf..64e33fc50 100644 --- a/services/dns/src/stackit/dns/models/partial_update_record_payload.py +++ b/services/dns/src/stackit/dns/models/partial_update_record_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.dns.models.record_payload import RecordPayload @@ -41,7 +42,8 @@ def action_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,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/dns/src/stackit/dns/models/partial_update_record_set_payload.py b/services/dns/src/stackit/dns/models/partial_update_record_set_payload.py index 9c718bc3d..0b50ae8e9 100644 --- a/services/dns/src/stackit/dns/models/partial_update_record_set_payload.py +++ b/services/dns/src/stackit/dns/models/partial_update_record_set_payload.py @@ -19,6 +19,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.dns.models.record_payload import RecordPayload @@ -42,7 +43,8 @@ class PartialUpdateRecordSetPayload(BaseModel): __properties: ClassVar[List[str]] = ["comment", "name", "records", "ttl"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +55,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/dns/src/stackit/dns/models/partial_update_zone_payload.py b/services/dns/src/stackit/dns/models/partial_update_zone_payload.py index 413c7bfbc..381fb4792 100644 --- a/services/dns/src/stackit/dns/models/partial_update_zone_payload.py +++ b/services/dns/src/stackit/dns/models/partial_update_zone_payload.py @@ -19,6 +19,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 Annotated, Self from stackit.dns.models.zone_extensions import ZoneExtensions @@ -73,7 +74,8 @@ class PartialUpdateZonePayload(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -84,8 +86,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/dns/src/stackit/dns/models/record.py b/services/dns/src/stackit/dns/models/record.py index da2192b9f..02787a0da 100644 --- a/services/dns/src/stackit/dns/models/record.py +++ b/services/dns/src/stackit/dns/models/record.py @@ -19,6 +19,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 @@ -34,7 +35,8 @@ class Record(BaseModel): __properties: ClassVar[List[str]] = ["content", "id"] 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/dns/src/stackit/dns/models/record_data_exchange.py b/services/dns/src/stackit/dns/models/record_data_exchange.py index dd64f94f0..a4736b33c 100644 --- a/services/dns/src/stackit/dns/models/record_data_exchange.py +++ b/services/dns/src/stackit/dns/models/record_data_exchange.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -35,7 +36,8 @@ class RecordDataExchange(BaseModel): __properties: ClassVar[List[str]] = ["comment", "content", "name", "ttl", "type"] 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/dns/src/stackit/dns/models/record_payload.py b/services/dns/src/stackit/dns/models/record_payload.py index 6949652c4..11747e9c3 100644 --- a/services/dns/src/stackit/dns/models/record_payload.py +++ b/services/dns/src/stackit/dns/models/record_payload.py @@ -19,6 +19,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 @@ -33,7 +34,8 @@ class RecordPayload(BaseModel): __properties: ClassVar[List[str]] = ["content"] 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/dns/src/stackit/dns/models/record_set.py b/services/dns/src/stackit/dns/models/record_set.py index 974e033fc..f62c9d329 100644 --- a/services/dns/src/stackit/dns/models/record_set.py +++ b/services/dns/src/stackit/dns/models/record_set.py @@ -26,6 +26,7 @@ StrictStr, field_validator, ) +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.dns.models.record import Record @@ -128,7 +129,8 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -139,8 +141,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/dns/src/stackit/dns/models/record_set_response.py b/services/dns/src/stackit/dns/models/record_set_response.py index 81c474833..8168c9050 100644 --- a/services/dns/src/stackit/dns/models/record_set_response.py +++ b/services/dns/src/stackit/dns/models/record_set_response.py @@ -19,6 +19,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.dns.models.record_set import RecordSet @@ -34,7 +35,8 @@ class RecordSetResponse(BaseModel): __properties: ClassVar[List[str]] = ["message", "rrset"] 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/dns/src/stackit/dns/models/validate_move_code_payload.py b/services/dns/src/stackit/dns/models/validate_move_code_payload.py index c566deb12..413532843 100644 --- a/services/dns/src/stackit/dns/models/validate_move_code_payload.py +++ b/services/dns/src/stackit/dns/models/validate_move_code_payload.py @@ -19,6 +19,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 @@ -33,7 +34,8 @@ class ValidateMoveCodePayload(BaseModel): __properties: ClassVar[List[str]] = ["code"] 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/dns/src/stackit/dns/models/zone.py b/services/dns/src/stackit/dns/models/zone.py index 11fa9b662..7a8e5b68c 100644 --- a/services/dns/src/stackit/dns/models/zone.py +++ b/services/dns/src/stackit/dns/models/zone.py @@ -27,6 +27,7 @@ StrictStr, field_validator, ) +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.dns.models.domain_extensions import DomainExtensions @@ -155,7 +156,8 @@ def visibility_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -166,8 +168,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/dns/src/stackit/dns/models/zone_data_exchange.py b/services/dns/src/stackit/dns/models/zone_data_exchange.py index 470e252ab..e6206a762 100644 --- a/services/dns/src/stackit/dns/models/zone_data_exchange.py +++ b/services/dns/src/stackit/dns/models/zone_data_exchange.py @@ -19,6 +19,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 Self from stackit.dns.models.record_data_exchange import RecordDataExchange @@ -33,7 +34,8 @@ class ZoneDataExchange(BaseModel): __properties: ClassVar[List[str]] = ["rrSets"] 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/dns/src/stackit/dns/models/zone_extensions.py b/services/dns/src/stackit/dns/models/zone_extensions.py index b635b75b4..7e9711cc5 100644 --- a/services/dns/src/stackit/dns/models/zone_extensions.py +++ b/services/dns/src/stackit/dns/models/zone_extensions.py @@ -19,6 +19,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 Self from stackit.dns.models.zone_observability_extension import ZoneObservabilityExtension @@ -33,7 +34,8 @@ class ZoneExtensions(BaseModel): __properties: ClassVar[List[str]] = ["observabilityExtension"] 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/dns/src/stackit/dns/models/zone_models_import_record_model.py b/services/dns/src/stackit/dns/models/zone_models_import_record_model.py index 441eae2f2..62f195b5e 100644 --- a/services/dns/src/stackit/dns/models/zone_models_import_record_model.py +++ b/services/dns/src/stackit/dns/models/zone_models_import_record_model.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -35,7 +36,8 @@ class ZoneModelsImportRecordModel(BaseModel): __properties: ClassVar[List[str]] = ["comment", "content", "name", "ttl", "type"] 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/dns/src/stackit/dns/models/zone_models_import_zone_json.py b/services/dns/src/stackit/dns/models/zone_models_import_zone_json.py index 72be11a07..f23f97b10 100644 --- a/services/dns/src/stackit/dns/models/zone_models_import_zone_json.py +++ b/services/dns/src/stackit/dns/models/zone_models_import_zone_json.py @@ -19,6 +19,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 Self from stackit.dns.models.zone_models_import_record_model import ( @@ -35,7 +36,8 @@ class ZoneModelsImportZoneJson(BaseModel): __properties: ClassVar[List[str]] = ["rrSets"] 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/dns/src/stackit/dns/models/zone_observability_extension.py b/services/dns/src/stackit/dns/models/zone_observability_extension.py index ccd1e69dd..7bd224554 100644 --- a/services/dns/src/stackit/dns/models/zone_observability_extension.py +++ b/services/dns/src/stackit/dns/models/zone_observability_extension.py @@ -19,6 +19,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 ZoneObservabilityExtension(BaseModel): __properties: ClassVar[List[str]] = ["observabilityInstanceId", "state"] 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/dns/src/stackit/dns/models/zone_response.py b/services/dns/src/stackit/dns/models/zone_response.py index c51b789dc..e78bca4ca 100644 --- a/services/dns/src/stackit/dns/models/zone_response.py +++ b/services/dns/src/stackit/dns/models/zone_response.py @@ -19,6 +19,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.dns.models.zone import Zone @@ -34,7 +35,8 @@ class ZoneResponse(BaseModel): __properties: ClassVar[List[str]] = ["message", "zone"] 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]: