Skip to content

Commit

Permalink
Better support for labeled arrays in array processes that previously …
Browse files Browse the repository at this point in the history
…discarded them. Should help with #233.
  • Loading branch information
m-mohr committed Dec 21, 2021
1 parent ffbb927 commit c8548cd
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased / Draft

### Changed

- Added better support for labeled arrays. Labels are not discarded in all cases anymore. Affected processes:
- `array_append`
- `array_concat`
- `array_modify`

## [1.2.0] - 2021-12-13

### Added
Expand Down
39 changes: 20 additions & 19 deletions proposals/array_append.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "array_append",
"summary": "Append a value to an array",
"description": "Appends a value to the end of the array. Array labels get discarded from the array.",
"description": "Appends a value to the end of the array.",
"categories": [
"arrays"
],
Expand All @@ -23,6 +23,18 @@
"schema": {
"description": "Any data type is allowed."
}
},
{
"name": "label",
"description": "If the given array is a labeled array, a new label for the new value should be given. If not given or `null`, the array index as string is used as the label. If in any case the label exists, a `LabelExists` exception is thrown.",
"optional": true,
"default": null,
"schema": {
"type": [
"string",
"null"
]
}
}
],
"returns": {
Expand All @@ -34,6 +46,11 @@
}
}
},
"exceptions": {
"LabelExists": {
"message": "A label with the specified name exists."
}
},
"examples": [
{
"arguments": {
Expand All @@ -49,21 +66,5 @@
3
]
}
],
"process_graph": {
"append": {
"process_id": "array_concat",
"arguments": {
"array1": {
"from_parameter": "data"
},
"array2": [
{
"from_parameter": "value"
}
]
},
"result": true
}
}
}
]
}
4 changes: 2 additions & 2 deletions proposals/array_concat.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "array_concat",
"summary": "Merge two arrays",
"description": "Concatenates two arrays into a single array by appending the second array to the first array. Array labels get discarded from both arrays before merging.",
"description": "Concatenates two arrays into a single array by appending the second array to the first array. Array labels are kept only if both given arrays are labeled. Otherwise, the labels get discarded from both arrays.",
"categories": [
"arrays"
],
Expand Down Expand Up @@ -58,4 +58,4 @@
]
}
]
}
}
2 changes: 1 addition & 1 deletion proposals/array_modify.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "array_modify",
"summary": "Change the content of an array (remove, insert, update)",
"description": "Modify an array by removing, inserting or updating elements. Updating can be seen as removing elements followed by inserting new elements (not necessarily the same number).\n\nAll labels get discarded and the array indices are always a sequence of numbers with the step size of 1 and starting at 0.",
"description": "Modify an array by removing, inserting or updating elements. Updating can be seen as removing elements followed by inserting new elements (not necessarily the same number).\n\nArray labels are kept only if both arrays given in `data` and `values` are labeled (or empty). Otherwise, all labels get discarded and the array indices are a sequence of numbers with the step size of 1 and starting at 0.",
"categories": [
"arrays"
],
Expand Down

0 comments on commit c8548cd

Please sign in to comment.