jfeliu007 / goplantuml

PlantUML Class Diagram Generator for golang projects
MIT License
1.77k stars 166 forks source link

Support generic struct types #145

Open aaronjwood opened 1 year ago

aaronjwood commented 1 year ago

This is the first phase for supporting generics. Attaching the generated SVG from the testingsupport code here for reference:

design

aaronjwood commented 1 year ago

I've included a fix for breakages on codebases which use generic method receivers. For example, this used to incorrectly parse to "":

type Foo[T string] struct {
}

func (h *Foo[T]) SomeMethod() {}
daniel-santos commented 1 year ago

oops, I started doing the same thing :( But I stuck the patch in issue #148 -- mine doesn't support interfaces yet. I hate duplicating effort!

daniel-santos commented 1 year ago

Hello @aaronjwood , Please never include reformatting or refactoring in a patch that makes functional changes, as this makes it very difficult to review. Separate out reformatting and whitespace changes into a separate patch, refactoring into another and the actual functional changes into a third.

I'm comparing your approach to mine, so I needed to separate these out, so here's an example: https://github.com/daniel-santos/goplantuml/tree/awood-cleaned-up (that I won't promise is correctly separated out).

daniel-santos commented 1 year ago

Hello @aaronjwood !

I just wanted to let you know that I'm working on a patch set, but it's a fairly dramatic departure, so it might end up a fork :frowning_face: Anyway, I'm using some of your code, mostly the test cases. I'm not actually sure that I know what I'm doing, but I guess we'll see where it ends up!

I was originally testing using an old version of plantuml without realizing it and things weren't coming out right. The big thing to me is the ability of plantuml to be able to export to xmi now. What would help me the most for my project would be to have my model imported into a UML editor and be able to render multiple class and sequence diagrams and then be able to update those diagrams as my code changes (by just updating the model part of the .xmi file).

Thanks for your work on this!

glacials commented 1 year ago

@jfeliu007 any news on whether this will be merged?