Support optional labels on logic-function input schema fields (#20471)

Adds an optional label field to logic-function input schema properties
(InputSchemaProperty and InputJsonSchema). When set, the workflow
builder renders the label in place of the raw property key for both leaf
inputs and nested sections; when unset, it falls back to the key.
jsonSchemaToInputSchema propagates the label so app authors can declare
it in their JSON schema. Payload paths, the variable picker, and saved
workflow inputs continue to use the property key — labels are
display-only.
This commit is contained in:
Abdul Rahman
2026-05-12 12:10:10 +05:30
committed by GitHub
parent 93df64b9b0
commit 1adb59f7f8
5 changed files with 65 additions and 10 deletions
@@ -10,7 +10,7 @@ import { getWorkflowCodeFieldsEnumSelectOptions } from '@/workflow/workflow-step
import { getWorkflowCodeFieldsLeafKind } from '@/workflow/workflow-steps/workflow-actions/code-action/utils/getWorkflowCodeFieldsLeafKind';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { isNonEmptyArray, isObject } from '@sniptt/guards';
import { isNonEmptyArray, isNonEmptyString, isObject } from '@sniptt/guards';
import { isDefined } from 'twenty-shared/utils';
import { type FunctionInput, type InputSchema } from 'twenty-shared/workflow';
import { themeCssVariables } from 'twenty-ui/theme-constants';
@@ -51,10 +51,18 @@ export const WorkflowEditActionCodeFields = ({
const currentPath = [...path, inputKey];
const pathKey = currentPath.join('.');
const schemaProperty = getInputSchemaPropertyAtPath(
inputSchema,
currentPath,
);
const displayLabel = isNonEmptyString(schemaProperty?.label)
? schemaProperty.label
: inputKey;
if (inputValue !== null && isObject(inputValue)) {
return (
<div key={pathKey}>
<InputLabel>{inputKey}</InputLabel>
<InputLabel>{displayLabel}</InputLabel>
<FormNestedFieldInputContainer>
<WorkflowEditActionCodeFields
functionInput={inputValue}
@@ -70,17 +78,13 @@ export const WorkflowEditActionCodeFields = ({
);
}
const schemaProperty = getInputSchemaPropertyAtPath(
inputSchema,
currentPath,
);
const leafKind = getWorkflowCodeFieldsLeafKind(schemaProperty);
if (leafKind === 'boolean') {
return (
<FormBooleanFieldInput
key={pathKey}
label={inputKey}
label={displayLabel}
defaultValue={
!isDefined(inputValue)
? undefined
@@ -100,7 +104,7 @@ export const WorkflowEditActionCodeFields = ({
return (
<FormNumberFieldInput
key={pathKey}
label={inputKey}
label={displayLabel}
defaultValue={
!isDefined(inputValue)
? undefined
@@ -124,7 +128,7 @@ export const WorkflowEditActionCodeFields = ({
return (
<FormSelectFieldInput
key={pathKey}
label={inputKey}
label={displayLabel}
defaultValue={
!isDefined(inputValue)
? undefined
@@ -144,7 +148,7 @@ export const WorkflowEditActionCodeFields = ({
return (
<FormTextFieldInput
key={pathKey}
label={inputKey}
label={displayLabel}
placeholder={t`Enter value`}
defaultValue={inputValue ? `${inputValue}` : ''}
readonly={readonly}