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

Cant pass Void or similar as variable to M2DocUtils.generate #475

Open
jmauersberger opened this issue Jan 9, 2023 · 4 comments
Open

Cant pass Void or similar as variable to M2DocUtils.generate #475

jmauersberger opened this issue Jan 9, 2023 · 4 comments

Comments

@jmauersberger
Copy link

jmauersberger commented Jan 9, 2023

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[ ] Documentation issue or request
[x] Support request => Please have a look to the support pages of our website : http://m2doc.org/support/

Current behavior

I can pass a map of variable -> value to the generate method, all works nice, I can pass single EMF objects, plain text and EMF collections. However, I can't pass null to express "Void" or "unset" (see also See also https://forum.mbse-capella.org/t/m2doc-how-to-use-optional-template-variables/4555/6)

Expected behavior

I would like to pass OclVoid or Null or any other value so that any AQL expression is not broken but evaluates to nothing.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

We use the m2doc API programatically, so variable definition and value assignment is on our end. We cant distinguish between "not set" and "empty" at the moment.

Environment


M2Doc version: 3.2.0
Eclipse version: 4.X
Platform version:  Windows  X.Y.Z

Others:

@ylussaud ylussaud added this to the 3.3.1 milestone May 2, 2023
@ylussaud
Copy link
Collaborator

ylussaud commented Sep 7, 2023

Did you try org.eclipse.acceleo.query.runtime.impl.Nothing:

variables.put("myVariable", new Nothing("..."))

@jmauersberger
Copy link
Author

Let me try ...

@jmauersberger
Copy link
Author

@ylussaud if I do that it improves a bit, anyway, I still get warnings that there is actually no service on that Object type available, so it does not work as in OCL where I can just execute any Collection operation also on OclVoid, right?

@ylussaud ylussaud modified the milestones: 3.3.1, 3.3.2 Sep 19, 2023
@ylussaud ylussaud modified the milestones: 3.3.2, 3.3.3 Dec 4, 2023
@ylussaud
Copy link
Collaborator

I think this issue might be fixed with AQL 8.x by doing something like:

variables.put("myVariable", new NullValue(types))

Where types is a Set of IType. This allows AQL to keep track of types for null values and prevent service lookup failures.

There is an experimental build of M2Doc with AQL 8.x, the update site is here. Note that this update site should be used for testing only.

Let me know if this helps with your issue.

@ylussaud ylussaud removed this from the 3.3.3 milestone Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants