fix(config): report computed fields as read-only on update (#1454)

PUT /v1/config/{path} answered "does not exist in model" when the
target was a computed field such as eos_device_instruction_entity_ids.
Raise an explicit read-only error instead, so API clients can tell
read-only fields from unknown ones.

Closes #913
This commit is contained in:
YTM-21
2026-10-26 07:16:16 +01:00
committed by GitHub
parent 58b968562e
commit 8f4fa6fe94
4 changed files with 35 additions and 1 deletions
+5
View File
@@ -569,6 +569,11 @@ class PydanticModelNestedValueMixin:
raise TypeError(f"Model '{model}' is not of class type.")
if key not in model.model_fields:
if key in model.model_computed_fields:
raise TypeError(
f"Field '{key}' of model '{model.__name__}' is a read-only computed "
"field and cannot be updated."
)
raise TypeError(f"Field '{key}' does not exist in model '{model.__name__}'.")
field_annotation = model.model_fields[key].annotation