Skip to content

Commit b5d7f05

Browse files
committed
fix(View): support blank descriptions in diagrams from the Structurizr UI (issue Midnighter#40)
1 parent f92e98f commit b5d7f05

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

CHANGELOG.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ History
55
Next Release
66
------------
77
* Fix: Don't duplicate relationships if ``add_nearest_neighbours()`` called twice (#63)
8+
* Fix: Support blank diagrams descriptions from the Structurizr UI (#40)
89

910
0.3.0 (2020-11-29)
1011
------------------

src/structurizr/view/view.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ViewIO(BaseModel, ABC):
4242
"""
4343

4444
key: str
45-
description: str
45+
description: str = ""
4646
software_system_id: Optional[str] = Field(default=None, alias="softwareSystemId")
4747
paper_size: Optional[PaperSize] = Field(default=None, alias="paperSize")
4848
automatic_layout: Optional[AutomaticLayoutIO] = Field(

tests/unit/view/test_view.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
"""Ensure the expected behaviour of View."""
1717

18-
import pytest
19-
2018
from structurizr.model import Model
2119
from structurizr.view.view import View, ViewIO
2220

@@ -82,7 +80,6 @@ def test_adding_all_relationships():
8280
assert rel2 in [vr.relationship for vr in view.relationship_views]
8381

8482

85-
@pytest.mark.xfail(strict=True)
8683
def test_missing_json_description_allowed():
8784
"""
8885
Ensure that missing descriptions in the JSON form are supported.
@@ -98,4 +95,5 @@ def test_missing_json_description_allowed():
9895
"key": "System1-SystemContext"
9996
}
10097
"""
101-
ViewIO.parse_raw(json) # Fails as description is missing
98+
io = ViewIO.parse_raw(json)
99+
assert io is not None

0 commit comments

Comments
 (0)