From 6f2816e7704eec759273f54c03ecf95362374f10 Mon Sep 17 00:00:00 2001 From: Rishabh Singh Date: Mon, 25 May 2026 20:06:08 +0530 Subject: [PATCH 1/2] Issue28: Updated DNS record to exclude name_in_zone in this scenario --- src/dns_data/models/record.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dns_data/models/record.py b/src/dns_data/models/record.py index a543225..27666e5 100644 --- a/src/dns_data/models/record.py +++ b/src/dns_data/models/record.py @@ -203,6 +203,10 @@ def to_dict(self) -> Dict[str, Any]: "additional_properties", ]) + # Exclude name_in_zone when absolute_name_spec and view are provided + if self.absolute_name_spec is not None and self.view is not None and self.name_in_zone == '': + excluded_fields.add("name_in_zone") + _dict = self.model_dump( by_alias=True, exclude=excluded_fields, From d3952a79412674c996e22d176b0dbcbfc8a0a2bd Mon Sep 17 00:00:00 2001 From: Rishabh Singh Date: Tue, 9 Jun 2026 10:44:16 +0530 Subject: [PATCH 2/2] Updated name_in_zone --- src/dns_data/models/record.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/dns_data/models/record.py b/src/dns_data/models/record.py index 27666e5..6e210cf 100644 --- a/src/dns_data/models/record.py +++ b/src/dns_data/models/record.py @@ -78,7 +78,7 @@ class Record(BaseModel): ipam_host: Optional[StrictStr] = Field( default=None, description="The resource identifier.") name_in_zone: Optional[StrictStr] = Field( - default='', + default=None, description= "The relative owner name to the zone origin. Must be specified for creating the DNS resource record and is read only for other operations." ) @@ -203,10 +203,6 @@ def to_dict(self) -> Dict[str, Any]: "additional_properties", ]) - # Exclude name_in_zone when absolute_name_spec and view are provided - if self.absolute_name_spec is not None and self.view is not None and self.name_in_zone == '': - excluded_fields.add("name_in_zone") - _dict = self.model_dump( by_alias=True, exclude=excluded_fields, @@ -260,8 +256,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "ipam_host": obj.get("ipam_host"), "name_in_zone": - obj.get("name_in_zone") - if obj.get("name_in_zone") is not None else '', + obj.get("name_in_zone"), "options": obj.get("options"), "provider_metadata":