diff --git a/server/gx-workflow-ls-format2/tests/integration/document.test.ts b/server/gx-workflow-ls-format2/tests/integration/document.test.ts index d449b3c..10cfe54 100644 --- a/server/gx-workflow-ls-format2/tests/integration/document.test.ts +++ b/server/gx-workflow-ls-format2/tests/integration/document.test.ts @@ -49,6 +49,7 @@ inputs: name: "text_param", doc: "", type: "text", + default: "text value", }, ]); }); diff --git a/server/gx-workflow-ls-native/src/nativeWorkflowDocument.ts b/server/gx-workflow-ls-native/src/nativeWorkflowDocument.ts index 287b059..fc0e4dc 100644 --- a/server/gx-workflow-ls-native/src/nativeWorkflowDocument.ts +++ b/server/gx-workflow-ls-native/src/nativeWorkflowDocument.ts @@ -5,6 +5,8 @@ import { TextDocument, WorkflowDataType, WorkflowDocument, + WorkflowInput, + WorkflowOutput, } from "@gxwf/server-common/src/languageTypes"; import { JSONDocument } from "vscode-json-languageservice"; import { ToolState, isWorkflowInputType, type ParameterInputToolState } from "./utils"; @@ -63,11 +65,13 @@ export class NativeWorkflowDocument extends WorkflowDocument { const toolStateValue = JSON.parse( toolStateNode?.valueNode?.value ? String(toolStateNode?.valueNode?.value) : "{}" ); - result.inputs.push({ + const inputDefinition: WorkflowInput = { name: String(labelValue), doc: String(annotationValue ?? ""), type: this.getInputType(stepTypeValue, toolStateValue), - }); + default: toolStateValue.default, + }; + result.inputs.push(inputDefinition); } }); return result; @@ -95,10 +99,11 @@ export class NativeWorkflowDocument extends WorkflowDocument { } const uuidNode = workflowOutput.properties.find((property) => property.keyNode.value === "uuid"); const uuidValue = String(uuidNode?.valueNode?.value); - result.outputs.push({ + const outputDefinition: WorkflowOutput = { name: String(labelValue), uuid: uuidValue, - }); + }; + result.outputs.push(outputDefinition); }); } }); diff --git a/server/gx-workflow-ls-native/tests/unit/nativeWorkflowDocument.test.ts b/server/gx-workflow-ls-native/tests/unit/nativeWorkflowDocument.test.ts index 96c30bf..7b0c29d 100644 --- a/server/gx-workflow-ls-native/tests/unit/nativeWorkflowDocument.test.ts +++ b/server/gx-workflow-ls-native/tests/unit/nativeWorkflowDocument.test.ts @@ -50,13 +50,13 @@ describe("NativeWorkflowDocument", () => { [ TestWorkflowProvider.workflows.validation.withOnlyInputs, [ - { doc: "", name: "Dataset Input", type: "data" }, - { doc: "", name: "Collection Input", type: "collection" }, - { doc: "", name: "Text Param", type: "text" }, - { doc: "", name: "Integer Param", type: "integer" }, - { doc: "", name: "Float Param", type: "float" }, - { doc: "", name: "Boolean Param", type: "boolean" }, - { doc: "", name: "Color Param", type: "color" }, + { default: undefined, doc: "", name: "Dataset Input", type: "data" }, + { default: undefined, doc: "", name: "Collection Input", type: "collection" }, + { default: undefined, doc: "", name: "Text Param", type: "text" }, + { default: 10, doc: "", name: "Integer Param", type: "integer" }, + { default: undefined, doc: "", name: "Float Param", type: "float" }, + { default: undefined, doc: "", name: "Boolean Param", type: "boolean" }, + { default: undefined, doc: "", name: "Color Param", type: "color" }, ], ], ])("returns the expected inputs", (wfContent: string, expectedInputs: WorkflowInput[]) => { diff --git a/shared/src/requestsDefinitions.ts b/shared/src/requestsDefinitions.ts index 41ff0be..48280fd 100644 --- a/shared/src/requestsDefinitions.ts +++ b/shared/src/requestsDefinitions.ts @@ -47,6 +47,7 @@ export interface WorkflowInput { name: string; type: WorkflowDataType; doc: string; + default?: unknown; } export interface GetWorkflowInputsResult {