question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot mark members as protected in classDiagram

See original GitHub issue

Attempting to mark a member as protected in a class diagram by using the octothorpe (hash) character causes the graph to not render. I’m attempting this based on the classDiagram documentation.

Specifically, the following code:

classDiagram
class MyClass
MyClass : #mytest

Causes the following error:

Parse error on line 3:
...s MyClassMyClass : #mytest
----------------------^
Expecting 'NEWLINE', 'EOF', got 'PUNCTUATION'

The private, public and package qualifiers all seem to work appropriately.

This reproduces using the Mermaid Live Editor

I’m using Windows 10 with Chrome 78.0.3904.87

I can work around this cosmetically by using #35; but it took me a while to figure that out. It’s unclear to me whether I lose any functionality by doing so. (I believe not.)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jgreywolfcommented, Nov 12, 2019

I dont think you are inept. I would be surprised if this works, since it still starts with “#” which is defined as PUNCTUATION in the code 😃

I am going to continue looking into this, in my attempts to get a better understanding of the mermaid code. Maybe I can even contribute 😉

2reactions
jgreywolfcommented, Nov 11, 2019

Interestingly, if you define the class with members inside of {}, this error does not happen. So it only appears to be when you are adding members individually

class BankAccount{
  +String onwer
  +BigDecimal balance
  #deposit(amount)
  +withdrawl(amount)
}

(Live Editor)

Read more comments on GitHub >

github_iconTop Results From Across the Web

OOAD - UML Basic Notations - Tutorialspoint
Public − A public member is visible from anywhere in the system. In class diagram, it is prefixed by the symbol '+'. ·...
Read more >
What does the '#' symbol mean in a UML class diagram?
It indicates a protected member of a class or other data type. - Indicates private. + Indicates public. # Indicates protected.
Read more >
The UML 2 class diagram - IBM Developer
UML identifies four types of visibility: public, protected, private, and package.
Read more >
UML Class Diagrams
A class diagram contains a rectangle for each class. ... This indicates that a Person object has private fields named name and birthDate,...
Read more >
UML Class Diagram Tutorial - Visual Paradigm
Objects and classes go hand in hand. We can't talk about one without talking about the other. And the entire point of Object-Oriented...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found