vincbeck commented on code in PR #67319:
URL: https://github.com/apache/airflow/pull/67319#discussion_r3312690491
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_state.py:
##########
@@ -40,6 +44,34 @@ class TaskStateCollectionResponse(BaseModel):
class TaskStateBody(StrictBaseModel):
- """Request body for setting a task state value."""
+ """
+ Request body for setting a task state value.
+
+ ``expires_at`` controls expiry:
+
+ - ``"default"``: apply the configured ``[state_store]
default_retention_days``.
+ - ``null``: never expire.
+ - aware datetime: expire at that time.
+ """
value: str = Field(max_length=65535)
+ expires_at: AwareDatetime | None | Literal["default"] = "default"
+
+
+class TaskStatePatchBody(StrictBaseModel):
+ """Request body for patching only the value of an existing task state
key."""
+
+ value: JsonValue
+
+ @field_validator("value")
+ @classmethod
+ def value_is_json_representable(cls, v: JsonValue) -> JsonValue:
+ if v is None:
+ raise ValueError("value cannot be null")
+ try:
+ serialized = json.dumps(v, allow_nan=False)
+ except ValueError:
+ raise ValueError("value contains non-finite numbers; NaN and Inf
are not JSON representable")
Review Comment:
Is this the only scenario? I feel like the error can be misleading if the
JSON error has nothing to do with numbers
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]