Enteee / plantuml-parser

Parse PlantUML with JavaScript or TypeScript
https://duckpond.ch/category/plantuml-parser
Apache License 2.0
138 stars 33 forks source link

Parser does not read the types of class attributes #78

Closed songyang-dev closed 2 years ago

songyang-dev commented 2 years ago

I am using this tool to parse class diagrams. The tool doesn't parse the types of attributes.

NodeJS script:

import { parse, parseFile, formatters } from 'plantuml-parser';

// Example PlantUML
const data = `
@startuml
!theme plain
class Publication {
  title : String
}
@enduml
`;

// parse PlantUML
const result = parse(data);

// Format and print parse result
console.log(
  formatters.default(result)
);

Output:

[
  {
    "elements": [
      {
        "name": "Publication",
        "title": "Publication",
        "isAbstract": false,
        "members": [
          {
            "name": "title",
            "isStatic": false,
            "accessor": "+",
            "type": ""
          }
        ],
        "extends_": [],
        "implements_": [],
        "generics": [],
        "stereotypes": []
      }
    ]
  }
]

The String type of the title attribute is not present in the output.

Enteee commented 2 years ago

good catch :+1: will try to get this fixed

Enteee commented 2 years ago

thank you for reporting this. This was implemented with #80 .