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

fix: improve how plantuml namespaces are rendered #615

Merged
merged 2 commits into from
Mar 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

'use strict';

const { ModelUtil } = require('@accordproject/concerto-core');
const DiagramVisitor = require('../../../common/diagramvisitor');

/**
Expand Down Expand Up @@ -131,13 +132,24 @@ class PlantUMLVisitor extends DiagramVisitor {
}

/**
* Escape versions and periods.
* @param {String} string - the object being visited
* Escape fully qualified names. We preserve the dots in the
* package name, remove the '@' symbol because it is invalid
* and remove the dots in the version (because otherwise packages get created)
* @param {String} input - the object being visited
* @return {String} string - the parameter
* @protected
*/
escapeString(string) {
return string.replace('@', '_');
escapeString(input) {
const hasNamespace = ModelUtil.getNamespace(input) !== '';
if(hasNamespace) {
const typeName = ModelUtil.getShortName(input);
const ns = ModelUtil.getNamespace(input);
const {name,version} = ModelUtil.parseNamespace(ns);
return `${name}_${version.replace(/\./g, '_')}.${typeName}`;
}
else {
return input;
}
}
}

Expand Down