RelationshipId sometimes changes on refresh #49
-
Hello, using Structurizr Lite and working on a plug-in, I realized that RelationshipId change on refresh. Is it the desired behavior ? It is possible to guarantee a constant json when the DSL remains the same ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
This is as designed ... the underlying Structurizr for Java library uses a sequential number as the basis for element/relationship IDs, so those IDs will change depending upon the order of lines in the DSL. If you would like to change this behaviour, you can write your own implementation of IdGenerator and plug it in to the model. |
Beta Was this translation helpful? Give feedback.
-
I would need to check, but that may be the case with (1) implied relationships and (2) relationships between software system/container instances. |
Beta Was this translation helpful? Give feedback.
This is the case ... with (2) the replicateElementRelationships() method finds eligible elements via a Java stream and does a
toSet()
, which won't guarantee the ordering, and therefore relationships may be allocated different IDs.Why the change only sometimes? Changes made in the diagram editor in your web browser will cause the workspace to be saved (i.e. saving the layout information). The underlying workspace is stored as a JSON file, and the Java serialisation process (from the DSL parser) will sometimes differ from the JavaScript seriali…