Module Schema Reference

A comprehensive reference for all available options when building module schemas for Stacksync Workflows.

Schema Structure

Root Schema Object

{
  "metadata": {
    "workflows_module_schema_version": "1.0.0"
  },
  "fields": [...],
  "ui_options": {...}
}

Required Properties:

  • metadata - Schema metadata configuration

  • fields - Array of field definitions

Optional Properties:

  • ui_options - Global UI configuration options


Metadata Configuration

workflows_module_schema_version

  • Type: String

  • Required: Yes

  • Default: "1.0.0"

  • Description: Specifies the schema version for compatibility


Field Types

String Fields

Basic String Field:

Properties:

  • id (string, required) - Unique field identifier

  • type (string, required) - Must be "string"

  • label (string, optional) - Display label for the field

  • description (string, optional) - Help text for users

  • default (string, optional) - Default value

Number Fields

Basic Number Field:

Properties:

  • id (string, required) - Unique field identifier

  • type (string, required) - Must be "number"

  • label (string, optional) - Display label

  • default (number, optional) - Default numeric value

Integer Fields

Basic Integer Field:

Boolean Fields

Basic Boolean Field:

Connection Fields

Connection Field:

Properties:

  • allowed_app_types (array, required) - List of supported connection types

  • allowed_connection_management_types (array, required) - Connection management options

Supported App Types:

  • salesforce - Salesforce CRM

  • hubspot - HubSpot CRM

  • postgres - PostgreSQL database

  • mysql - MySQL database

  • custom_api - Custom API connections

Connection Management Types:

  • managed - Platform-managed connections

  • custom - User-provided credentials

Object Fields

Simple Object Field:

Object with Choices:

Array Fields

String Array:

Object Array:


UI Widgets

Available Widgets

input (default for strings)

textarea (multi-line text)

password (hidden text input)

SelectWidget (dropdown selection)

checkbox (boolean checkbox)

CodeblockWidget (code editor)

hidden (hidden field)

CodeblockWidget Languages

Supported syntax highlighting languages:

  • json - JSON format

  • sql - SQL queries

  • javascript - JavaScript code

  • python - Python code

  • yaml - YAML configuration

  • xml - XML markup

  • html - HTML markup

  • css - CSS styling


Validation Rules

Basic Validation

required - Field is mandatory

min_length - Minimum string length

max_length - Maximum string length

minimum - Minimum numeric value

maximum - Maximum numeric value

pattern - Regular expression validation

Format Validation

email - Email address format

uri - URI format

date - Date format (YYYY-MM-DD)

date-time - Date-time format (ISO 8601)

uuid - UUID format


Dynamic Content

Basic Content Configuration

Properties:

  • type (array, required) - Content management types

  • content_objects (array, required) - List of content objects to fetch

Content Management Types:

  • managed - Platform manages the content loading

  • custom - Custom content loading logic

Content Dependencies

Field-dependent content:

Array item dependencies:


Choices Configuration

Static Choices

Simple string choices:

Object choices:

Dynamic Choices

Empty choices for dynamic loading:


Schema Rules (Conditional Logic)

Basic Rules Structure

Condition Operators

equal - Exact match

not_equal - Not equal to

is_in - Value in array

is_not_in - Value not in array

is_empty - Field is empty

is_not_empty - Field has value

greater_than - Numeric comparison

less_than - Numeric comparison

Logic Combinators

and - All conditions must be true

or - Any condition must be true

Rule Effects

apply_as options:

  • merge - Merge with existing field configuration

  • fully_replace - Replace entire field configuration

Show/Hide Fields:

Hide Fields:


UI Layout Options

Global UI Options

Field Ordering:

Field-Level UI Options

Horizontal Layout:


Advanced Features

Action Handlers

Action handlers define what should happen when users interact with fields. They trigger specific behaviors when field values change.

load_schema

Purpose: Triggers a schema reload when the field value changes, allowing for dynamic updates to other fields based on the new value.

Basic Usage:

What happens when load_schema is triggered:

  1. You change the value of the field country

  2. A trigger sends an HTTP POST request to the module /schema endpoint with :

  • the full schema

  • the full form data

  • the full content objects

  1. The module returns a new schema

  2. The new schema is merged with the existing schema

  3. The frontend updates the UI to reflect the new schema

Common Use Cases

Use Case 1: Cascading Dropdowns

Use Case 2: Conditional Field Display

Use Case 3: Dynamic Validation

Backend Implementation

When load_schema: true is triggered, your /content endpoint receives the updated form data:

Performance Considerations

  • Use Sparingly: Only add load_schema: true to fields that actually need to trigger updates

  • Optimize Backend: Ensure your /content endpoint responds quickly to avoid UI lag

  • Cache When Possible: Cache static data that doesn't change between requests

  • Batch Updates: If multiple fields need to trigger updates, consider grouping them

Best Practices

  1. Clear User Feedback: Show loading indicators when schema is reloading

  2. Preserve User Input: Ensure field values aren't lost during reload

  3. Error Handling: Gracefully handle failures in content loading

  4. Debouncing: Consider debouncing rapid field changes to avoid excessive requests

Debugging Tips

  • Check browser network tab to see /content requests when fields change

  • Verify that content_object_depends_on_fields references match your field IDs exactly

  • Test with browser console open to catch any JavaScript errors

  • Use simple test data first, then add complexity


Complete Field Example

Here's a comprehensive example showing most available options:

This specification covers all major aspects of module schema configuration. Refer to this document when building your schemas to understand all available options and their proper usage.

Last updated