It's impossible to set "equal to None" filter when calling REST API
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mistral |
Fix Released
|
High
|
ali abdelal |
Bug Description
Mistral provides various filters in API for that could be applied for object fields. Examples of filters are: "neq" (not equal), "gt" (greater than) etc.
We can do something like this:
1) GET /v2/executions?
2) GET /v2/executions?
#1 will return only a workflow execution whose "task_execution_id" equals to the given UUID.
#2 will return workflow executions whose "task_execution_id" is not equal to the given UUID.
However, there's no visible way how to set the condition: "equals to None" (or empty). If we assign "task_execution_id" to any of the values that can mean "empty" like "", "null", "None" then it give the error:
Invalid input for field/attribute task_execution_id. Value: ''. unable to convert to uuid
Use case: we want to request all "top level" workflow executions, i.e. those that are not sub workflows.
Proposed fix: we need have a notion of "empty value". For that we can use the reserved keyword "None" and/or "null" so that if a filter for some field is explicitly set to "None" it is treated as "equals to None" on the backend. Example:
GET /v2/executions?
Changed in mistral: | |
milestone: | none → pike-3 |
importance: | Undecided → High |
Changed in mistral: | |
milestone: | pike-3 → queens-1 |
Changed in mistral: | |
milestone: | queens-1 → queens-3 |
Changed in mistral: | |
milestone: | queens-3 → rocky-2 |
Changed in mistral: | |
assignee: | nobody → ali (alielal) |
Changed in mistral: | |
status: | Triaged → In Progress |
After more thinking, it seems that in order to support the use case mentioned in the description (fetching all top level executions) we can just add the new parameter to /executions endpoint "top_level= False|True" .
Otherwise, we have a trade off:
* Deny using "None" as a string value for string fields
* If we want to support it with just not specifying a field value (e.g. my_field=) then we deny filtering objects by empty field value (i.e. "give me all objects whose X field value is "").
And in both case we're breaking backwards compatibility.