Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support optional groups in templates #19

Open
mattfysh opened this issue Sep 25, 2024 · 0 comments
Open

support optional groups in templates #19

mattfysh opened this issue Sep 25, 2024 · 0 comments

Comments

@mattfysh
Copy link
Member

templates can currently interpolate optional variables, which typically results in the template (and object entry, if applicable) being evaluated to null and removed, for example:

GET http://example.com
User-Agent: $first__${second}123

set obj = {
  foo: value__$first__${second}123
}

if either first or second variables are null selections, the User-Agent header and object entry foo are dropped entirely.

in some cases, you might want optional variables to evaluate to an empty string instead of the whole template evaluating to null. there may also be pieces of the template that should only render if a variable is defined, e.g.GET http://example.com$[/page-$page] should evaluate to http://example.com when $page is null, and to http://example.com/page-3 when $page is 3

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

No branches or pull requests

1 participant