From 1dc640352fe9120e9419c9dff6b56fb8a95a03e3 Mon Sep 17 00:00:00 2001 From: Abhijit Wakchaure <49677669+awakchau-tibco@users.noreply.github.com> Date: Mon, 19 Jul 2021 19:18:09 +0530 Subject: [PATCH] Updated json function description and output datatypes to be more clear (#141) * added new json functions * added bew url functions * updated the json function description to support array * updated test case for url encode to include path escaping as well * added new url function: escapedPath, fixed names of existing functions * updated: json function descriptions and output data types * updated: json function descriptions --- function/json/README.md | 38 ++++++++++++++++++----------------- function/json/descriptor.json | 16 +++++++-------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/function/json/README.md b/function/json/README.md index 484faf36..109b960c 100644 --- a/function/json/README.md +++ b/function/json/README.md @@ -24,7 +24,7 @@ Get value of associated key from json object ## length() -Get the number of elements in json object or array +Get the number of top level elements in json object or array ### Input Args @@ -34,9 +34,10 @@ Get the number of elements in json object or array ### Output -| Arg | Type | Description | -|:----------|:-------|:------------------------------------| -| returnVal | int | The length items in the json object | +| Arg | Type | Description | +|:--------------|:-------|:---------------------------------------| +| lengthInteger | int | The top level items in the json object | + ## numbersToString() Convert every number type to string in a json object or array @@ -49,12 +50,13 @@ Convert every number type to string in a json object or array ### Output -| Arg | Type | Description | -|:----------|:-------|:---------------------------------------------------------| -| returnVal | any | The json object or array with numbers encoded as strings | +| Arg | Type | Description | +|:------------------|:-------|:---------------------------------------------------------| +| jsonObjectOrArray | any | The json object or array with numbers encoded as strings | + ## objKeys() -Get the list of top level keys of json object +Get the list of all top level keys of json object ### Input Args @@ -64,13 +66,13 @@ Get the list of top level keys of json object ### Output -| Arg | Type | Description | -|:----------|:-------|:---------------------------| -| returnVal | array | The list of top level keys | +| Arg | Type | Description | +|:---------------|:-------|:---------------------------| +| arrayOfStrings | array | The list of top level keys | ## objValues() -Get list of all the values of a json object +Get the list of all top level values of json object ### Input Args @@ -80,9 +82,9 @@ Get list of all the values of a json object ### Output -| Arg | Type | Description | -|:----------|:-------|:---------------------------------------| -| returnVal | array | The list all the values in json object | +| Arg | Type | Description | +|:--------------|:-------|:------------------------------------------------| +| arrayOfValues | array | The list of all top level values in json object | ## path() @@ -115,6 +117,6 @@ Set the value of existing key or add new key and set it's value in a json object ### Output -| Arg | Type | Description | -|:----------|:-------|:------------------------| -| returnVal | any | The updated json object | \ No newline at end of file +| Arg | Type | Description | +|:-----------|:-------|:------------------------| +| jsonObject | any | The updated json object | \ No newline at end of file diff --git a/function/json/descriptor.json b/function/json/descriptor.json index ac74cccf..464dd695 100644 --- a/function/json/descriptor.json +++ b/function/json/descriptor.json @@ -26,8 +26,8 @@ }, { "name": "length", - "description": "Get the number of elements in json object or array", - "example": "json.length(jsonObjectOrArray) => value", + "description": "Get the number of top level elements in json object or array", + "example": "json.length(jsonObjectOrArray) => lengthInteger", "args": [ { "name": "jsonObjectOrArray", @@ -41,7 +41,7 @@ { "name": "numbersToString", "description": "Convert every number type to string in a json object or array", - "example": "json.numbersToString(jsonObjectOrArray) => value", + "example": "json.numbersToString(jsonObjectOrArray) => jsonObjectOrArray", "args": [ { "name": "jsonObjectOrArray", @@ -54,8 +54,8 @@ }, { "name": "objKeys", - "description": "Get the list of top level keys of json object", - "example": "json.objKeys(jsonObject) => value", + "description": "Get the list of all top level keys of json object", + "example": "json.objKeys(jsonObject) => arrayOfStrings", "args": [ { "name": "jsonObject", @@ -69,8 +69,8 @@ }, { "name": "objValues", - "description": "Get list of all the values of a json object", - "example": "json.objValues(jsonObject) => value", + "description": "Get the list of all top level values of json object", + "example": "json.objValues(jsonObject) => arrayOfValues", "args": [ { "name": "jsonObject", @@ -103,7 +103,7 @@ { "name": "set", "description": "Set the value of existing key or add new key and set it's value in a json object", - "example": "json.set(jsonObject, \"key\", value) => value", + "example": "json.set(jsonObject, \"key\", value) => jsonObject", "args": [ { "name": "jsonObject",