Skip to content

Add support for ternary expressions #699

@romain-grecourt

Description

@romain-grecourt

Support ternary expression in archetype v2:

<enum name="color" default="${shape} == 'circle' ? 'red' : 'blue'">
    <option value="red" label="Red"/>
    <option value="green" label="Green"/>
    <option value="blue" label="Blue"/>
</enum>

Update Expression to return a Value instead of boolean a let the caller decide how to resolve the result.

Investigate if we can introduce a new syntax for substituting expressions.
E.g.

default="#{${shape} == 'circle' ? 'red' : 'blue'}"
default="`${shape} == 'circle' ? 'red' : 'blue'}`"
default="#{shape == 'circle' ? 'red' : 'blue'}"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions