Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0 for arrays with labels #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions array_concat.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"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.\n\nArray labels are kept only if both given arrays are labeled. Otherwise, the labels get discarded from both arrays. The process fails with an `ArrayLabelConflict` exception if a label is present in both arrays. Conflicts must be resolved beforehand.",
"categories": [
"arrays"
],
"experimental": true,
"parameters": [
{
"name": "array1",
Expand Down Expand Up @@ -37,9 +36,31 @@
}
}
},
"exceptions": {
"ArrayLabelConflict": {
"message": "At least one label exists in both arrays and the conflict must be resolved before."
}
},
"examples": [
{
"description": "Concatenates two arrays containing different data type.",
"description": "Concatenates two numerical arrays.",
"arguments": {
"array1": [
1.5,
2.5
],
"array2": [
5
]
},
"returns": [
1.5,
2.5,
5
]
},
{
"description": "Concatenates two arrays containing different data type, may not always be supported.",
"arguments": {
"array1": [
"a",
Expand Down
13 changes: 8 additions & 5 deletions 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 one of them is 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. The process fails with an `ArrayLabelConflict` exception if a label is present in both arrays.",
"categories": [
"arrays"
],
Expand Down Expand Up @@ -39,7 +39,7 @@
"name": "length",
"description": "The number of elements in the `data` array to remove (or replace) starting from the given index. If the array contains fewer elements, the process simply removes all elements up to the end.",
"optional": true,
"default": 1,
"default": 0,
"schema": {
"type": "integer",
"minimum": 0
Expand All @@ -58,6 +58,9 @@
"exceptions": {
"ArrayElementNotAvailable": {
"message": "The array can't be modified as the given index is larger than the number of elements in the array."
},
"ArrayLabelConflict": {
"message": "At least one label exists in both arrays and the conflict must be resolved before."
}
},
"examples": [
Expand All @@ -72,7 +75,8 @@
"values": [
"b"
],
"index": 1
"index": 1,
"length": 1
},
"returns": [
"a",
Expand Down Expand Up @@ -115,8 +119,7 @@
"values": [
"b"
],
"index": 1,
"length": 0
"index": 1
},
"returns": [
"a",
Expand Down