Skip to content

Latest commit

 

History

History
138 lines (123 loc) · 3.78 KB

component_metadata.md

File metadata and controls

138 lines (123 loc) · 3.78 KB

Component metadata

Here you can find a reference of the different properties that must be contained in the metadata object of the component.

This is the expected structure of the metadata file:

{
    "name": "component_name",
    "title": "Component title",
    "description": "Component description",
    "version": "1.0.0",
    "icon": "component_icon.svg",
    "externalReference": {
        "label": "External documentation",
        "href": "https://example.com"
    },
    "cartoEnvVars": [],
    "inputs": [
        {
            "name": "input_table",
            "title": "Input table",
            "description": "The table to add the column to",
            "type": "Table"
        }
    ],
    "outputs": [
        {
            "name": "output_table",
            "title": "Output table",
            "description": "The table with the column added",
            "type": "Table"
        }
    ]
}

Some important notes about the metadata structure:

  • name: A unique identifier for the component that matches its folder name
  • title: A human-readable title displayed in the UI
  • description: A brief explanation of what the component does
  • version: The semantic version number of the component
  • icon: The SVG icon filename to display (must exist in icons folder)
  • externalReference: Optional object with label and URL for external documentation
    • label: The label to display in the UI
    • href: The URL to the external documentation
  • cartoEnvVars: Array of environment variables the component needs access to
  • inputs: Array of input parameters the component accepts
  • outputs: Array of output parameters the component produces

Inputs

  • Table

    {
        "name": "inputtable",
        "title": "Input table",
        "description": "The input table",
        "type": "Table"
    }
  • Boolean

    {
        "name": "converttometers",
        "title": "Convert to meters",
        "description": "Convert values to meters",
        "type": "Boolean" //asdfcp 
    }
  • String

    {
        "name": "selectstatement",
        "title": "SELECT statement",
        "description": "The SELECT statement to run",
        "type": "String"
    }
  • Number (it accepts min, max and default properties)

    {
        "name": "distance",
        "title": "Distance",
        "description": "The buffer distance",
        "type": "Number"
    }
  • Selection

    {
        "name": "units",
        "title": "Units",
        "description": "Units to use",
        "type": "Selection",
        "options": ["meters", "miles"]
    }
  • Column

    {
        "name": "geocol",
        "title": "Geo column",
        "description": "The column containing geometries",
        "type": "Column",
        "parent": "source_table"
    }

Outputs

It should contain an array of output elements. Since outputs generated by workflow components can only be tables, an output element is defined just like an input table element. For instance:

{
    "name": "outputtable",
    "title": "Output table",
    "description": "The output table",
    "type": "Table"
}

CARTO environment variables

You can include an array with the list of environmental variables that your component will need. Those variables will be automatically declared and assigned, and you will have them available to be used in your component code.

These are the variables that are currently supported:

  • analyticsToolboxDataset
  • analyticsToolboxVersion
  • apiBaseUrl
  • accessToken
  • dataExportDefaultGCSBucket
  • bigqueryProjectId
  • bigqueryRegion

The property is not optional, so, in case you don't need environment variables in your component, use an empty array.