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

Nested generics with class name definitions on ClassDiagram #5804

Open
kairi003 opened this issue Sep 1, 2024 · 0 comments
Open

Nested generics with class name definitions on ClassDiagram #5804

kairi003 opened this issue Sep 1, 2024 · 0 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@kairi003
Copy link
Contributor

kairi003 commented Sep 1, 2024

Description

Hi, I have discovered that there is a non-functioning demo on the local demo page in the development environment:
https://github.com/kairi003/mermaid/blob/115cb071b09056c34c9b750579432d4232a10500/demos/classchart.html#L148-L160

    <pre class="mermaid">
    classDiagram
      class Person {
        +Id : Guid
        +FirstName : string
        +LastName : string
        -privateProperty : string
        #ProtectedProperty : string
        ~InternalProperty : string
        ~AnotherInternalProperty : List~List~string~~
      }
      class People List~List~Person~~
    </pre>

L159 probably defines a class named PeopleList<List<Person>>, but it does not work.

Nesting of Generic Types by ~ works for members, but not for class name definitions.

Not nested case: class People List~List~

classDiagram
  class People List~List~
Loading

Nested case: class People List~List~Person~~

classDiagram
  class People List~List~Person~~
Loading

Translated with DeepL.com (free version)

Steps to reproduce

  1. Setup dev env.
  2. Run ./run dev and access to http://localhost:9000/classchart.html

Screenshots

image

Code Sample

No response

Setup

  • Mermaid version: develop branch, commit #115cb071b09056c34c9b750579432d4232a10500
  • Browser and Version: Chrome

Suggested Solutions

  • classDiagram.jison needs to be modified to allow nested generics
  • classDb.ts > splitClassNameAndType() needs to be modified to properly parse nested generics (using parseGenericTypes()?)

Additional Context

I’m a beginner with both this project and Jison. I apologize, but I’m hoping someone can help resolve this.

@kairi003 kairi003 added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

1 participant