Skip to content

Identifying strings are expressions in place where the string might also be a constant #848

Closed
@fjtirado

Description

@fjtirado

Currently we can write

set: 
  name: Javi

or

set: 
   name: ${.input.name}

However $ is a reserved keyword in JQ and {} are used in json, think of this expression written in json

"set": {"name": "${$loopVariable}"} 

(I wrote it wrong three times :))

I think we should consider following options

  1. Everything is an expression

This implies user has to escape literals.

set: 
  name: '"Javi"'
set: 
   name: .input.name
  1. Change the expression prefix.

Use something different than ${} for example, use ``

set: 
  name: Javi
set: 
   name: `.input.name`

We can use a different character, for example, #, but with this one we need to add white spaces around the expression

set: 
   name: # .input.name #
  1. Use a new keyword.

So after the property name, you expect either constant or expr and use as default expr (that default might be overriden by user in the header of the workflow definition)

  • Default to expr:
set: 
  name:
    constant: Javi
set: 
   name: .input.name
  • Default to constant:
set: 
  name:  Javi
set: 
   name: 
     expr:  .input.name

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: specChanges in the Specificationchange: featureNew feature or request. Impacts in a minor version change

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions