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

Add support for ternary expressions #699

Open
Tracked by #930
romain-grecourt opened this issue Apr 12, 2022 · 1 comment · May be fixed by #899
Open
Tracked by #930

Add support for ternary expressions #699

romain-grecourt opened this issue Apr 12, 2022 · 1 comment · May be fixed by #899
Assignees
Milestone

Comments

@romain-grecourt
Copy link
Contributor

romain-grecourt commented Apr 12, 2022

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'}"
@romain-grecourt romain-grecourt added this to the 3.0.0-M4 milestone Apr 12, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.0-M4, 3.0.0-M5 Jun 30, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.0-M5, 3.0.0, 3.0.1 Jul 13, 2022
@romain-grecourt
Copy link
Contributor Author

Instead of coming up with a new syntax, we can allow expressions that evaluate to strings.
This means that the following must be valid:

  • default="foo"
  • default="${foo}"

@romain-grecourt romain-grecourt modified the milestones: 3.0.2, 3.0.3 Dec 16, 2022
@barchetta barchetta added the P2 label Dec 21, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.4, 3.0.5 Feb 10, 2023
@aserkes aserkes linked a pull request Mar 9, 2023 that will close this issue
@romain-grecourt romain-grecourt modified the milestones: 3.0.5, 3.0.6 Jun 6, 2023
@romain-grecourt romain-grecourt modified the milestones: 3.0.6, 3.0.7 Jul 6, 2023
@romain-grecourt romain-grecourt modified the milestones: 4.0.0, 4.0.1, 4.0.2 Oct 23, 2023
@romain-grecourt romain-grecourt modified the milestones: 4.0.2, 4.0.3 Nov 15, 2023
@romain-grecourt romain-grecourt modified the milestones: 4.0.3, 4.0.5 Jan 9, 2024
@romain-grecourt romain-grecourt modified the milestones: 4.0.5, 4.0.6 Jan 9, 2024
@romain-grecourt romain-grecourt modified the milestones: 4.0.6, 4.0.7 Mar 12, 2024
@romain-grecourt romain-grecourt modified the milestones: 4.0.7, 4.0.8, 4.0.10 Jul 30, 2024
@romain-grecourt romain-grecourt modified the milestones: 4.0.10, 4.0.11, 4.0.12 Aug 19, 2024
@romain-grecourt romain-grecourt modified the milestones: 4.0.12, 4.0.13, 4.0.14 Oct 2, 2024
@romain-grecourt romain-grecourt modified the milestones: 4.0.14, 4.0.15 Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants