slackapi / deno-slack-sdk

SDK for building Run on Slack apps using Deno
https://api.slack.com/automation
MIT License
162 stars 27 forks source link

[BUG] `input_parameters` does not utilize `default` #332

Open JVenberg opened 3 months ago

JVenberg commented 3 months ago

The deno-slack versions

"deno-slack-hub/": "https://deno.land/x/deno_slack_hub@0.4.0/",
"deno-slack-sdk/": "https://deno.land/x/deno_slack_sdk@2.13.0/",
"deno-slack-api/": "https://deno.land/x/deno_slack_api@2.6.0/"

Deno runtime version

deno 1.44.4 (release, x86_64-unknown-linux-gnu)
v8 12.6.228.9
typescript 5.4.5

OS info #22~22.04.1-Ubuntu SMP Tue Apr 30 16:08:18 UTC 2024

Describe the bug

The default for parameters in input_parameters is not used

Steps to reproduce

#workflows/example.ts
export const ExampleWorkflow = DefineWorkflow({
  ...
  input_parameters: {
    properties: {
      duration: {
        type: Schema.types.integer,
        default: 30,
      },
    },
  },
});
ExampleWorkflow.addStep(
  Schema.slack.functions.SendMessage,
  {
    channel_id: <Channel>,
    message: `${ExampleWorkflow.inputs.duration}`,
  }
);

Expected result

Outputs message: "30"

Actual result

parameter_validation_failed - Null value for non-nullable parameter `message`

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

filmaj commented 3 months ago

Yup, seems like a legit problem. I will raise this internally.