Closed fatih-acar closed 1 week ago
Added to 0.16.1 provided that this is a quick fix. I think it should be enough with this change:
diff --git a/backend/infrahub/core/node/__init__.py b/backend/infrahub/core/node/__init__.py
index 54ca35c52..502ed7d52 100644
--- a/backend/infrahub/core/node/__init__.py
+++ b/backend/infrahub/core/node/__init__.py
@@ -263,6 +263,8 @@ class Node(BaseNode, metaclass=BaseNodeMeta):
# -------------------------------------------
# Validate Input
# -------------------------------------------
+ if "updated_at" in fields and "updated_at" not in self._schema.valid_input_names:
+ fields.pop("updated_at")
for field_name in fields.keys():
if field_name not in self._schema.valid_input_names:
errors.append(ValidationError({field_name: f"{field_name} is not a valid input for {self.get_kind()}"}))
@@ -422,6 +424,7 @@ class Node(BaseNode, metaclass=BaseNodeMeta):
self._existing = True
if updated_at:
+ kwargs["updated_at"] = updated_at
self._updated_at = Timestamp(updated_at)
If this causes other problems we could perhaps move this to another milestone.
The problem is that we use an "updated_at" argument within the Node
class to set the old metadata field _updated_at
. The end goal would be to have correct metadata properties for each node where you as a user would be able to see when a node was created and when it was last updated. Even with that in place we shouldn't limit users from using the attribute name updated_at
.
Component
API Server / GraphQL Infrahub 0.14.2
Current Behavior
When using a schema defining nodes that have an attribute named
updated_at
, it is not possible to change the value of this attribute and it is always blank/null.Expected Behavior
updated_at
attributes should be editable as expectedSteps to Reproduce
Load the following schema:
Create a new Country node with a name, created_at and updated_at set. You will see that created_at is correctly set but updated_at is not.
Additional Information
No response