Flows and dashboards get ids: the store is addressed by id with a key index, the first start gives every document its key as id, fluksio store migrate --dry-run and ls; the rename routes are gone
This commit is contained in:
@@ -32,6 +32,11 @@ def _validate_name(value: str) -> str:
|
||||
return value
|
||||
|
||||
|
||||
def _validate_id(value: str) -> str:
|
||||
"""An id is a name too, so it stays one safe path segment. Empty is unset."""
|
||||
return value and _validate_name(value)
|
||||
|
||||
|
||||
def _megabytes(value: Any) -> Any:
|
||||
"""``2G`` and ``512M`` and ``512`` all mean a number of megabytes."""
|
||||
if not isinstance(value, str):
|
||||
@@ -302,6 +307,11 @@ class FlowInput(BaseModel):
|
||||
class FlowDef(BaseModel):
|
||||
"""One atomic flow."""
|
||||
|
||||
#: Which flow this is: the directory it is stored in, never changed once
|
||||
#: given. A flow from before ids existed has its key as its id. Optional
|
||||
#: on the way in, since the store fills it, and always set on the way out.
|
||||
id: str = ""
|
||||
#: The key: unique among flows, and the namespace of the flow's messages.
|
||||
name: str
|
||||
title: str = ""
|
||||
nodes: list[NodeDef] = Field(default_factory=list)
|
||||
@@ -331,6 +341,11 @@ class FlowDef(BaseModel):
|
||||
),
|
||||
)
|
||||
|
||||
@field_validator("id")
|
||||
@classmethod
|
||||
def _check_id(cls, value: str) -> str:
|
||||
return _validate_id(value)
|
||||
|
||||
@field_validator("name")
|
||||
@classmethod
|
||||
def _check_name(cls, value: str) -> str:
|
||||
@@ -402,6 +417,7 @@ class MessageHistory(BaseModel):
|
||||
|
||||
|
||||
class FlowSummary(BaseModel):
|
||||
id: str = ""
|
||||
name: str
|
||||
title: str = ""
|
||||
#: Whether running it means one finite execution or leaving it running.
|
||||
|
||||
Reference in New Issue
Block a user