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

Problem when generating a mermaid file with KSP files inside a sub-package #11

Open
SergioRuizGarcia opened this issue Oct 29, 2024 · 0 comments

Comments

@SergioRuizGarcia
Copy link

SergioRuizGarcia commented Oct 29, 2024

Observed
Whenever we have a KSP file with a sub-package the resulting mermaid file produced by activating the option mermaid: true in the yaml config file is incorrect.

Consider the following:

  • A KSP file defined in a sub-package, like package fr.myCompany.myProject.domain.myBusinessDomain, with an entity defined
  • A yaml Vertigo config file with the option mermaid: true active

When executing the mermaid file generation, I get the following inside the generated HTML file:

...
<ul class="menu-list">
  <li><a @click="changeActivePanel('fr.myCompany.myProject.domain.myBusinessDomain')">fr.myCompany.myProject.domain.myBusinessDomain</a></li>
</ul>
...

<script>
  var graphData = {};
  graphData.fr.myCompany.myProject.domain.myBusinessDomain = `classDiagram
...

So when loading the package in my browser, when trying to execute the line window.mermaid.render('graphDiv', graphData[panelName], I have an error because I am trying to access graphData['fr.myCompany.myProject.domain.myBusinessDomain'] when I should be accessing it like graphData[fr][myCompany][myProject][domain][myBusinessDomain].

Proposed solution:

Change the mermaid FTL template to initialize the graphData object with a string key:

graphData['${featureEntry.getKey()}'] = `classDiagram

in lines 263 and 270.

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

1 participant