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

Expose context values as template model #609

Closed
romain-grecourt opened this issue Jan 13, 2022 · 2 comments · Fixed by #889
Closed

Expose context values as template model #609

romain-grecourt opened this issue Jan 13, 2022 · 2 comments · Fixed by #889
Assignees
Milestone

Comments

@romain-grecourt
Copy link
Contributor

romain-grecourt commented Jan 13, 2022

We currently have duplication in our archetypes to expose context value as model.
We need to expose context values as model directly to avoid the duplication.

E.g.

    <step label="Customize Project">
        <inputs>
            <text name="name" label="Project name" optional="true" default="myproject"/>
            <text name="groupId" label="Project groupId" optional="true" default="com.examples"/>
            <text name="artifactId" label="Project artifactId" optional="true" default="myproject"/>
            <text name="version" label="Project version" optional="true" default="1.0-SNAPSHOT"/>
            <text name="package" label="Java package name" optional="true" default="com.example.myproject"/>
        </inputs>
        <output>
            <model>
                <value key="name">${name}</value>
                <value key="groupId">${groupId}</value>
                <value key="artifactId">${artifactId}</value>
                <value key="project-version">${version}</value>
                <value key="package">${package}</value>
            </model>
        </output>
    </step>

I.e we need the ability to use {{groupId}} to reference ${groupId} without having to declare a model value.

Also we currently do not support dot notation as part of the mustache support. It would be a good time to re-visit that and implement support for dot notation in templates.

The dot notation would be useful in order to traverse the model. E.g. {{foo.bar}} refers to a map keyed as foo that contains a key bar.

Also, since this issue is about adding support for context, we should support context paths. This would mean supporting ~ and ...

@romain-grecourt romain-grecourt added this to the 3.0.0-M2 milestone Jan 13, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.0-M2, 3.0.0-M3 Jan 18, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.0-M3, 3.0.0-M4 Jan 28, 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 Jul 13, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.0, 3.0.1 Jul 15, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.2, 3.0.3 Dec 16, 2022
@romain-grecourt romain-grecourt added P2 and removed P3 labels Dec 19, 2022
@romain-grecourt romain-grecourt modified the milestones: 3.0.4, 3.0.5 Feb 10, 2023
@aserkes
Copy link
Contributor

aserkes commented Feb 17, 2023

@romain-grecourt, you mentioned :

The dot notation would be useful in order to traverse the model. E.g. {{foo.bar}} refers to a map keyed as foo that contains a key bar.

Also, since this issue is about adding support for context, we should support context paths. This would mean supporting ~ and ...

Does it mean that {{foo.bar}} with ~ and .. is planned to be used in mustache templates or it will be used in archetype xml files?

@romain-grecourt
Copy link
Contributor Author

Does it mean that {{foo.bar}} with ~ and .. is planned to be used in mustache templates or it will be used in archetype xml files?

In mustache templates.

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.

2 participants