Skip to main content

Check out Port for yourself ➜ 

Advanced input configurations

This page covers advanced configuration options for workflow user inputs, including dependencies, visibility controls, and dynamic defaults.

Input dependencies

Use the dependsOn property to create dependencies between inputs. When an input depends on another, it will be re-evaluated when the dependency changes.

{
"properties": {
"environment": {
"type": "string",
"title": "Environment",
"enum": ["development", "staging", "production"]
},
"cluster": {
"type": "string",
"format": "entity",
"blueprint": "cluster",
"title": "Cluster",
"dependsOn": ["environment"],
"dataset": {
"combinator": "and",
"rules": [
{
"property": "environment",
"operator": "=",
"value": {
"jqQuery": ".form.environment"
}
}
]
}
}
}
}

In this example, the cluster input filters its available entities based on the selected environment.

Visibility controls

Control when inputs are visible using the visible property.

{
"hiddenInput": {
"type": "string",
"title": "Hidden Input",
"visible": false
}
}

Dynamic defaults

Set default values dynamically using JQ expressions.

{
"properties": {
"serviceName": {
"type": "string",
"title": "Service Name"
},
"repositoryName": {
"type": "string",
"title": "Repository Name",
"default": {
"jqQuery": ".form.serviceName + \"-repo\""
},
"dependsOn": ["serviceName"]
}
}
}

Read-only inputs

Mark inputs as read-only to display values that users cannot modify:

{
"workflowRunId": {
"type": "string",
"title": "Workflow Run ID",
"default": {
"jqQuery": ".run.id"
},
"readOnly": true
}
}

Input ordering

Control the display order of inputs using the order property:

{
"properties": {
"name": { "type": "string", "title": "Name" },
"environment": { "type": "string", "title": "Environment" },
"description": { "type": "string", "title": "Description" }
},
"order": ["environment", "name", "description"]
}

Example

This example shows a userInputs configuration that combines input dependencies, conditional defaults, and visibility controls for a deployment form.

Deployment form configuration (click to expand)
{
"userInputs": {
"properties": {
"environment": {
"type": "string",
"title": "Environment",
"enum": ["development", "staging", "production"],
"enumColors": {
"development": "blue",
"staging": "orange",
"production": "green"
}
},
"service": {
"type": "string",
"format": "entity",
"blueprint": "service",
"title": "Service",
"dependsOn": ["environment"],
"dataset": {
"combinator": "and",
"rules": [
{
"property": "environment",
"operator": "=",
"value": { "jqQuery": ".form.environment" }
}
]
}
},
"version": {
"type": "string",
"title": "Version",
"description": "Version tag to deploy"
},
"replicas": {
"type": "number",
"title": "Replicas",
"default": {
"jqQuery": "if .form.environment == \"production\" then 3 else 1 end"
},
"dependsOn": ["environment"],
"minimum": 1,
"maximum": 10
},
"enableMonitoring": {
"type": "boolean",
"title": "Enable Monitoring",
"default": {
"jqQuery": ".form.environment == \"production\""
},
"dependsOn": ["environment"]
},
"monitoringEndpoint": {
"type": "string",
"format": "url",
"title": "Monitoring Endpoint",
"visible": {
"jqQuery": ".form.enableMonitoring == true"
},
"dependsOn": ["enableMonitoring"]
}
},
"required": ["environment", "service", "version"],
"order": [
"environment",
"service",
"version",
"replicas",
"enableMonitoring",
"monitoringEndpoint"
]
}
}