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

Archetype: add support for conditional blocks #747

Open
Tracked by #930
romain-grecourt opened this issue Jul 21, 2022 · 4 comments · May be fixed by #993
Open
Tracked by #930

Archetype: add support for conditional blocks #747

romain-grecourt opened this issue Jul 21, 2022 · 4 comments · May be fixed by #993
Assignees
Labels
archetype enhancement New feature or request P2
Milestone

Comments

@romain-grecourt
Copy link
Contributor

Add a conditional block to group blocks that are nested with the nested condition.
This will help to avoid repeating the same condition on consecutive blocks.

@romain-grecourt romain-grecourt added enhancement New feature or request archetype labels Jul 21, 2022
@romain-grecourt romain-grecourt added this to the 3.0.1 milestone Jul 21, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.2, 3.0.3 Dec 16, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.4, 3.0.5 Feb 10, 2023
@tvallin tvallin self-assigned this May 2, 2023
@tvallin
Copy link
Member

tvallin commented May 2, 2023

If I understand the enhancement correctly, today it works this way:

<output>
      <model>
          <list key="foo" if="bar">
              <value>foo</value>
          </list>
          <list key="foo1" if="bar">
              <value>foo1</value>
          </list>
      </model>
</output>

and we want to do this:

<output>
      <model>
          <condition if="bar">
              <list key="foo">
                  <value>foo</value>
              </list>
              <list key="foo1">
                  <value>foo1</value>
              </list>
           </condition>
      </model>
</output>

@romain-grecourt
Copy link
Contributor Author

Yes. It would be nicer though if we were able to have <if expr="true"> and <else>.

@tvallin
Copy link
Member

tvallin commented May 9, 2023

Okay, so I can think of two options:

<output>
      <model>
          <if expr="bar">
              <list key="foo">
                  <value>foo</value>
              </list>
              <else/>
              <list key="foo1">
                  <value>foo1</value>
              </list>
           </if>
      </model>
</output>

or

<output>
      <model>
          <if expr="bar">
              <list key="foo">
                  <value>foo</value>
              </list>
          </if>
          <else>
              <list key="foo1">
                  <value>foo1</value>
              </list>
           </else>
      </model>
</output>

@romain-grecourt
Copy link
Contributor Author

romain-grecourt commented May 9, 2023

The 2nd one is better, though the XML reader will be a bit tricky.
We should also support else-if

@barchetta barchetta mentioned this issue May 10, 2023
4 tasks
@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
@tvallin tvallin linked a pull request Oct 18, 2023 that will close this issue
@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, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archetype enhancement New feature or request P2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants