Skip to content

Optional and default settings for parameters work together confusingly #24

@orasimus

Description

@orasimus

We should take a look at how parameters' optional and default work.

I would assume something like this:

- default: 1
(- optional: False by default)
-> we set the parameter to 1 if the API call does not define something else

(no default value by default)
- optional: True
-> we can leave the parameter empty, and the Execution will start without a value

- default: 1
- optional: True
-> we set the parameter to 1 if the API call does not define something else, and it can also be left empty, and the Execution will start without a value

Today it works something like this:

- default: 1
(- optional: False by default)
-> if we don't define a value, the Execution does not start

// So here I think it should start if there's a default value given, even if the API call does not give one

(no default value by default)
- optional: True
-> we can leave the parameter empty, and the Execution will start without a value

- default: 1
- optional: True
-> we set the parameter to 1 if the API call does not define something else. If left empty, the Execution will start with the default value of 1.

// So here I think if we on purpose give an empty value, we shouldn't pass the default value on to the execution.

Thoughts?

Ari and Pierre from Skillup encountered this confusion, as they wanted to have an execution that starts even if no value is given, but then using a default value from the valohai.yaml. So they ended up using both default: 1 and optional: True, even though they'd assumed having default: 1 would implicitly mean that no value is required.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions