Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Input schema

The input schema of a connector defines how the input will look within the Tray.io workflow builder. The way inputs are defined across operations and connectors is heavily inspired by JSONSchema, but is not compatible.

Global inputs

The global_schema.js file is where you would define any global properties for the connector.
For example, the following configuration would add a string input called foo to all operations in the connector. This input will be required, and will have the description specified.

module.exports = {
    input: {
        foo: {
            type: 'string',
            required: true,
            description: 'Some input description here.',
        }
    }
}

Operation inputs

Most of the time you will want to define properties on the operation level. To do this, you would put them in the schema.js file within the operation folder.

To add a user_id number input to an operation get_user you would add input to the following file: connectors/my-connector/get_user/schema.js

module.exports = {
    input: {
        user_id: {
            title: 'User ID',
            type: 'number',
            required: true,
            description: 'The ID of the user.',
        }
    }
}

Disabling global schema

If you want a specific operation to not inherit the global inputs defined in global_schema.js, you can use the globals setting.

module.exports = {
    globals: false,

    input: {
        user_id: {
            title: 'User ID',
            type: 'number',
            required: true,
            description: 'The ID of the user.',
        }
    }
}

The above schema.js file will ignore any global inputs and just display user_id.

connectors.json

In the top level of the connector folder, you will see a file called connectors.json. When you run the connector server using node main.js, the schema of all operations is combined into this file automatically. As this file is auto generated you should not edit it directly, but it can be useful for debugging your schema code to see what is actually being generated.


Table of contents