How to define data type for action inputs?

I have a subworkflow that has one action:

version: 1.0

description: “Run average calculation on score”

input:
  - score

tasks:
  get_score:
    action: tf.run_calculator
    input:
          score: <% ctx().score %>

Now when I run this subworkflow using st2 run myPack.myAction score=20 it sends string score to underlying action. Is there a way to set data type here?

NB: I’ve seen samples that we can set type: "integer" on action inputs, but what about subworkflows? How can I set data type for my score input?

Hi @alirezastack,

You should able to specify the datatype in the workflow action metadata file. Following is an example.

here is the workflow action metadata file.

name: myAction
pack: myPack
description: Run average calculation on score.
runner_type: orquesta
entry_point: workflows/average-calculator.yaml
enabled: true
parameters:
  score:
    required: true
    type: integer
    default: 0

here is the workflow itself.

version: 1.0
description: “Run average calculation on score”

input:
  - score

tasks:
  get_score:
    action: tf.run_calculator
    input:
          score: <% ctx().score %>