Midnighter / structurizr-python

A Python 3 port of Simon Brown's Structurizr diagrams-as-code architecture description tool.
https://structurizr.com/
Apache License 2.0
66 stars 16 forks source link

Preserve tag order as in other SDKs #22

Closed ilaif closed 4 years ago

yt-ms commented 4 years ago

Is this as simple as using an OrderedSet as in https://code.activestate.com/recipes/576694/? If so is there a preference for reproducing this class versus adding a dependency to an existing implementation in PyPi?

Midnighter commented 4 years ago

I'm actually not 100% sure yet that this is an issue at all. As you can see in the definition of ModelItemIO https://github.com/Midnighter/structurizr-python/blob/9396d6996d1b39ce875a8ccdf5d7f8ac45e337dc/src/structurizr/model/model_item.py#L32, tags are read as a string and split into a list. When serializing, the list is joined into a single string again. This is how the Structurizr API expects the tags. I don't see how this could change the order.

@ilaif am I mixing up the root of this issue?

ilaif commented 4 years ago

I think that the cause of out-of-order tags is that in the python implementation the internal tags are inserted before the user's while in the other sdks its implemented in reverse order (internal after user)

yt-ms commented 4 years ago

Ah, you're right, we're using a List rather than a Set (Java uses a LinkedHashSet, presumably to preserve the ordering). That should make the fix even easier then. Should I take this one?

Midnighter commented 4 years ago

Please go ahead :smiley: