Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Specification Audit

Active Version

v2.0

CDAP >= v3.0Initial Version
Dev Versionv2.1CDAP > 3.4Adding label to metadata section to display better plugin names. CDAP-5340

...

Groups’ refers to collection of configurations of a plugin. An example structure of a configuration JSON would look like this - Sample JSON

Code Block
languagejs
titleCustomPlugin.json
linenumberstrue
{
 "metadata": {...},
 "inputs": null,
 "configuration-groups": [
   {group1},
   {group2},
   ...
 ],
 "output": [
   {configuration-output-1},
   {configuration-output-2},
   ...
 ]
}

...

In the above mentioned sample JSON, fields 1 & 2 are configurations of CustomPlugin defined in the backend. We could now configure them in the JSON so that it gets easier to use view/edit them in hydrator.

Configurations for a field

Configurations of a field are the set of properties that we define in the JSON, that governs what/how that particular plugin field gets rendered in hydrator. 

...

Code Block
languagejs
titleCustomPlugin.json
linenumberstrue
{
 "configuration-groups": [
   {
     "label": "My Group Title",
     "properties": [
       {
         "name": "Field1",
         "widget-type": "numberbox",
         "widget-attributes": {
           "default": "1"
         },
		 "plugin-function": {
		   "method": "POST",
		   "endpoint": "getSchema",
		   "output-property": "schema"
		 }
       },
       {
         "name": "Field2",
         "widget-type": "json-editor"
       }
     ]
   }
 ],
 "output": [
   {output-property1} 
   {output-property2}
   ...
 ]
}

Widgets

A widget in UI represents a component that we could use to set the value of a property of a plugin. It could be anything representable in HTML. For instance if our CustomPlugin has a property that requires a JSON value, we could use a json-editor to set value to it. A widget, in general, is a component that we can use to represent a property of a plugin to attach a value to it. The following are the list of widgets that we right now have in CDAP that could be readily be used.

 

Widget-type

Description

Attributes

Output data type

Sample JSON

textbox

Default HTML textbox to enter any string

default: default value for the widget

string

 

Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My A1Property PropertyLabel",
  "widget-type": "textbox",
  "widget-attributes": {
    "default": "Some Text"
  }
}

 

number

Default HTML number textbox. Can enter only valid numbers.

default: default value for the widget
min: minimum value for the number box
max: maximum value for the number box

string

 

Code Block
languagejs
linenumberstrue
{
  "name": "Property1property1",
  "label": "My A1Property PropertyLabel",
  "widget-type": "number",
  "widget-attributes": {
    "default": "1",
    "min": "1",
    "max": "100"
  }
}

 

password

Default HTML password box.

No attributes

string

 

Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My A1Property PropertyLabel",
  "widget-type": "password",
  "widget-attributes": {}
}

 

datetime

Date time picker. Used to set date (in string) for any property

default, format (format could be ISO, long, short or full format dates. Reference

string

 

Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My Date PropertyMy Property Label",
  "widget-type": "datetime",
  "widget-attributes": {
    "default": "current",
    "format": "MM-DD-YYYY"
  }
}

 

csv

Comma separated values. Each value is entered in a separate box

No attributes

comma-separated string

 

Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My DateProperty PropertyLabel",
  "widget-type": "csv",
  "widget-attributes": {}
}

 

dsvDelimiter-separated values; each value is entered in a separate box

delimiter: delimiter used to separate the values

delimiter-separated string
Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My DateProperty PropertyLabel",
  "widget-type": "dsv",
  "widget-attributes": {
    "delimiter": ":"
  }
}

json-editor

Json editor to pretty-print and auto format JSON while typing

default: default serialized JSON value for the widget

string

 

Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My DateProperty PropertyLabel",
  "widget-type": "json-editor",
  "widget-attributes": {
    "default": "{ "{ p1: value1\"p1\": \"value\" }"
  }
}

 

 

javascript-editor,

python-editor

An editor to write Javscript (javascript-editor) or Python (python-editor) as a value for a property.

default: default string value for the widget

string

 

Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My DateProperty PropertyLabel",
  "widget-type": "javascript-editor",
  "widget-attributes": {
    "default": "function shouldFiltertransform(input, emitter, context)  {\n  return false emitter.emit(input);\n}"
  }
}

 

keyvalue

A key-value editor which allows you to construct map.

delimiter: delimiter for the key-value pairs
kv-delimiter: delimiter between key and value

string

 

Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My DateProperty PropertyLabel",
  "widget-type": "keyvalue",
  "widget-attributes": {
    "delimiter": ",",
    "kv-delimiter": ":"
  }
}

 

keyvalue-dropdownSimilar to keyvalue widget, but with a drop-down value list
delimiter: delimiter for the key-value pairs
kv-delimiter: delimiter between key and value
dropdownOptions: list of drop-down options to display
string
Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My Date Property",
  "widget-type": "keyvalue-dropdown",
  "widget-attributes": {
    "delimiter": ",",
    "kv-delimiter": ":",
    "dropdownOptions": [ "Option1", "Option2"]
  }
}

select

An HTML drop-down with a list of values; allows one choice from the list

values: list of values for the drop-down
default: default value from the list

string

 

Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My DateProperty PropertyLabel",
  "widget-type": "keyvalueselect",
  "widget-attributes": {
    "values": ["Apples", "Oranges", "Bananas"],
    "default": "Bananas"
  }
}
dataset-selector, stream-selectorA type-ahead textbox with a list of datasets (dataset-selector) or streams (stream-selector) from the CDAP instanceNo attributesstring
Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My DateProperty PropertyLabel",
  "widget-type": "streamdataset-selector",
  "widget-attributes": {}
}

ds-multiplevalues

A delimiter separated values widget that allows to specify a list of values separated by a delimiter.

numValues: number of values

values-delimiter: delimiter between values
delimiter: delimiter between set of values
placeholders: list of placeholders for each value textboxes
string
Code Block
linenumberstrue
{
  "name": "Property1property1",
  "label": "My KeyProperty Value MapperLabel",
  "widget-type": "ds-multiplevalues",
  "widget-attributes": {
    "delimiter": ",",
    "values-delimiter": ":",
    "numValues": "3",
    "placeholders": ["Input fieldField", "Lookup", "OuputOutput fieldField"]
  }
}

Versioning

The versioning of plugin config json is closely tied to plugin deployment and maintenance. Every time a hydrator plugin developer deploys a plugin(artifact) he(she) will couple the plugin JARs with config JSON and documentation. The CLI or UI that is deploying the artifact (plugin) will add the config JSON and documentation with it. The config JSON and documentation will be added as properties of an artifact. Each plugin under an artifact will be added as a property to the artifact and each property (plugin) will have JSON as its value with doc and widgets as keys. an example structure would look something like this,

...