Supported Custom jq Functions

The Rapid Adapter Builder platform supports the following custom jq functions:

connectivity::to_entries

This custom to_entries function allows custom keys and value labels.

This table describes input and output arguments for this function.

Input Output Examples
  • JSON object converted to array.
  • KeyName for each key in array.
  • KeyName for each value in array.

JSON array of entries.

Input JSON:

{ "potato": true, "broccoli": false }

Expression in adapter definition document:

{ "arguments": { "body": "${ {vegetableFeedback : connectivity::to_entries(.input; .configuration.key; \"like\") } }" } }

Output in JSON format where .configuration.key resolves to veggieName:

{ ... "body" : { "vegetableFeedback" : [ { "veggieName" : "potato", "like" : true }, { "veggieName" : "broccoli", "like" : false } ] } }

connectivity::from_entries

This custom from_entries function allows custom keys and value labels.

This table describes input and output arguments for this function.

Input Output Examples
  • JSON object converted to object.
  • KeyName for each key in array.
  • KeyName for each value in array.

JSON object

Input JSON:

{ "vegetables": [ { "veggieName": "potato", "like": true }, { "veggieName": "broccoli", "like": false } ] }

Expression in adapter definition document:

{ "arguments": { "body": "${ {vegetableFeedback : connectivity::from_entries(.input.vegetables; .configuration.key; \"like\") } }" } }

Output in JSON format where .configuration.key resolves to veggieName:

{ ... "body" : { "vegetableFeedback" : { "potato" : true, "broccoli" : false } } }

connectivity::json_data_to_json_schema

This function converts JSON data into JSON schema.

This table describes the input and output arguments.

Input Output Examples

Any JSON object or array.

JSON schema as JSON Object type.

Input JSON

{ "vegetables": [ { "veggieName": "potato", "like": true }, { "veggieName": "broccoli", "like": false } ] }

Expression in adapter definition document:

{ "arguments": { "body": "${ {vegetableFeedback : connectivity::json_data_to_json_schema(.input.vegetables) } }" } }

Output JSON

{ "body": { "vegetableFeedback": { "type": "array", "items": { "type": "object", "properties": { "veggieName": { "type": "string" }, "like": { "type": "boolean" } } } } } }

connectivity::swagger_schema

This function parses the swagger document and extracts the request and response json schema.

This table describes the input and output arguments.

Input Output Examples
  • The Swagger document in JSON format.
  • The path Id in the Swagger document.
  • The HTTP method under the path of the second parameter.
  • The response or request in the form of a enum value.

JSON schema

Input JSON

{ "swagger": "2.0", "info": { "description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", "version": "1.0.6", "title": "Swagger Petstore", ... }, "host": "petstore.swagger.io", "basePath": "/v2", ... }

Expression in adapter definition document:

{ "name": "parseSchema", "type": "expression", "operation": "connectivity::swagger_schema(.swagger; .configuration.path; .configuration.method; \"request\")" }

Output JSON

{ "type": "object", "properties": { "body": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, ... } } } }