Fix variable search for iterators (#14742)

Add specific search util for iterators. Also making workflow version id
optional in compute step output schema endpoint to avoid breaking
changes on next release.

Before


https://github.com/user-attachments/assets/2ceb5b38-4c0a-4d38-8f57-0e4467dcfd93

After


https://github.com/user-attachments/assets/3ce503ac-5299-4bca-906f-e0fef379df7c
This commit is contained in:
Thomas Trompette
2025-09-26 15:42:40 +02:00
committed by GitHub
parent 9cd0025aed
commit ead351cb9e
12 changed files with 304 additions and 19 deletions
@@ -47,7 +47,7 @@ export class WorkflowSchemaWorkspaceService {
}: {
step: WorkflowTrigger | WorkflowAction;
workspaceId: string;
workflowVersionId: string;
workflowVersionId?: string;
}): Promise<OutputSchema> {
const stepType = step.type;
@@ -108,8 +108,8 @@ export class WorkflowSchemaWorkspaceService {
return {
currentItem: await this.computeLoopCurrentItemOutputSchema({
items,
workflowVersionId,
workspaceId,
workflowVersionId,
}),
currentItemIndex: {
label: 'Current Item Index',
@@ -308,12 +308,12 @@ export class WorkflowSchemaWorkspaceService {
private async computeLoopCurrentItemOutputSchema({
items,
workflowVersionId,
workspaceId,
workflowVersionId,
}: {
items: string | undefined | unknown[];
workflowVersionId: string;
workspaceId: string;
workflowVersionId?: string;
}): Promise<Leaf | Node> {
if (!isDefined(items)) {
return DEFAULT_ITERATOR_CURRENT_ITEM;
@@ -322,8 +322,8 @@ export class WorkflowSchemaWorkspaceService {
if (isString(items) && isValidVariable(items)) {
return this.computeIteratorCurrentItemFromVariable({
items,
workflowVersionId,
workspaceId,
workflowVersionId,
});
}
@@ -332,13 +332,17 @@ export class WorkflowSchemaWorkspaceService {
private async computeIteratorCurrentItemFromVariable({
items,
workflowVersionId,
workspaceId,
workflowVersionId,
}: {
items: string;
workflowVersionId: string;
workspaceId: string;
workflowVersionId?: string;
}): Promise<Leaf | Node> {
if (!isDefined(workflowVersionId)) {
return DEFAULT_ITERATOR_CURRENT_ITEM;
}
const workflowVersion =
await this.workflowCommonWorkspaceService.getWorkflowVersionOrFail({
workflowVersionId,