Skip to content

feat: Add default value support for parameters#743

Open
dsabre wants to merge 1 commit intoadnanh:masterfrom
dsabre:pr/args-default-value
Open

feat: Add default value support for parameters#743
dsabre wants to merge 1 commit intoadnanh:masterfrom
dsabre:pr/args-default-value

Conversation

@dsabre
Copy link
Copy Markdown

@dsabre dsabre commented Nov 14, 2025

Add support for the default keyword in pass-arguments-to-command.
When provided, this value is used if the user does not supply the argument or if it is empty, instead of raising an error or using an empty value.
Documentation updated in docs/Referencing-Request-Values.md.
Example:

{
  "source": "url",
  "name": "q",
  "default": "123"
}

In this example, if the URL query does not contain q or it is empty, the value "123" will be used.
If default is omitted, the behavior remains unchanged.


if err != nil || paramsValueSliceLength <= int(index) {
// Return default value if nothing found and defaultValue is set
if defaultValue != "" {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would need a mechanism for figuring out whether the default value is actually set in the configuration as null and empty string "" could also be valid default values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants