5.3 Kaholo Plugin config.json Schema

The config.json file for each plugin specifies many details about the plugin, including it’s name, description, version, categories, matching keywords, main code file, icon image file, methods, parameters, kaholo account options, and various details about how the methods and parameters behave. It is an essential component of a Kaholo plugin impacting greatly the way a plugin behaves. The format of the file is JSON. Here the schema of config.json is explained in detail.

Top Level Dictionary

The top level of the config.json is about the plugin itself. This inlcudes the following items:

  • name – The name of the plugin. Must only contain alphanumeric characters, hyphens, and underscores
  • viewName – The user-friendly name presented in the UI
  • type – Can be either “executer” for plugins, or “trigger” for triggers. For now we will stick to plugins, and so we will use “executer”
  • imgUrl – a 512×512 png image Kaholo will use to display the plugin in the Design page and other places
  • execProgram – currently only “node” is supported, to run the plugin using node.js
  • main – the main JavaScript code file, must export all methods specified in config.json
  • version – the version number of the plugin
  • description – a user-friendly description of what the plugin provides
  • category – one or more of several categories as plugins are grouped in the Design page
  • keywords – several keywords that users might use to search for the plugin
  • settings – An object described below
  • auth – An object described below
  • methods – An object described below

Settings

The "settings": {} object, which is optional, is found at the top level of config.json. This is used to declare parameters for which the user can configure a default setting. This is particularly useful for parameters that are usually configured the same in every Action of every Pipeline, but may occasionally need to be overridden with some other user-defined value at the Action level. Default settings for these parameters are a convenience to the end users only.

Auth

The "auth": {} object, which is optional, is found at the top level of the config.json. This is for the definition of which parameters belong in Kaholo Accounts. Accounts are used to organize parameters that are in some way grouped together as a collection, typically required for use of all/most methods, often related to authentication, and rarely changing from one Action in a Pipeline to the next.

The only dictionary item in "auth": {} object is "authId":. This string serves only as a unique identifier for this plugin’s Kaholo Account.

params

The "auth": {"params": []} array is an array of dictionaries, each describing one parameter that appears within this plugin’s Kaholo Account. Parameters specified here should not also be specified by individual methods but are available for use by every method in the plugin.

Methods

The "auth": {} object is found at the top level of the config.json. This specifies details of each of the Methods available in the plugin and the parameters that go with them.

Settings, Auth, and Methods Params Array

All of Settings, Auth, and Methods objects may contain a "params": [] array of dictionaries. This section describes the key:value pairs that may be specified for each parameter. All of these are available for use in Methods, but Settings and Auth make use of only a subset of these specifications.

  • name (required) – the name of the parameter as used in code
  • viewName (required) – a user-friendly name for the parameter as seen in the user interface
  • type (required) – one of several types of parameters as listed here:
    • string – a one-line string parameter
    • int – an integer value
    • float – a floating point decimal value
    • text – a multi-line string parameter
    • boolean – a true/false parameter
    • vault – a parameter stored encrypted in the Kaholo vault
    • options – a parameter selected from a drop-down menu of options
    • autocomplete – a parameter selected from a drop-down menu that is dynamically populated with choices by a function in code
    • code – a parameter evaluated using JavaScript code
  • description – a short text if needed to explain what belongs in the parameter
  • placeholder – an example value to provide a visual hint to the user what to enter in the parameter
  • learnUrl – a link to a URL that contains more information or documentation about a parameter
  • required – a boolean indicating if the parameter must have a value (true), or may be left unconfigured (false)
  • default – a value that is filled into the parameter by default. Similar to a placeholder except this default value will remain and be used in the Action unless a user overrides it by entering something else.
  • codedExample – sometimes the value entered in the normal parameter and a value as should be provided by the code layer are different. In this case, codedExample provides an example JSON object of the type expected when the code layer is being used. For example, Google Cloud Compute Engine parameter “Subnet” expects only “mysubnetname” as a normal autocomplete parameter, but if the code layer is used, it must be “regions/myregion/subnetworks/mysubnetname” instead.
  • language – for parameters of type “code”, this determines which code language is to be used. Supported languages are: TypeScript, JavaScript, CSS, LESS, SCSS, JSON, HTML, XML, PHP, C#, C++, Razor, Markdown, Diff, Java, VB, CoffeeScript, Handlebars, Batch, Pug, F#, Lua, Powershell, Python, Ruby, SASS, R, Objective-C

Parameter Type Options

The Options type Parameters and Settings are presented in the Kaholo UI as a drop-down button where the user is prompted with a list to select the desired option. The Options type Parameters and Settings should include an additional field called “options”, like this:

        "options": [
            {
              "id": "ap-southeast-1",
              "name": "Singapore"
            },
            {
              "id": "eu-central-1",
              "name": "Frankfurt"
            }
        ]
    

The “options” object is an array of objects with two items each:

  • id – The resulting string value of the parameter in code.
  • name – The text shown in the Kaholo UI when the user is selecting an option.