Skip to content

Commit f92e98f

Browse files
committed
fix(View): demonstrate problem with missing descriptions (issue Midnighter#40)
1 parent 6ba54f3 commit f92e98f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/unit/view/test_view.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

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

18+
import pytest
1819

1920
from structurizr.model import Model
20-
from structurizr.view.view import View
21+
from structurizr.view.view import View, ViewIO
2122

2223

2324
class DerivedView(View):
@@ -79,3 +80,22 @@ def test_adding_all_relationships():
7980
assert len(view.relationship_views) == 2
8081
assert rel1 in [vr.relationship for vr in view.relationship_views]
8182
assert rel2 in [vr.relationship for vr in view.relationship_views]
83+
84+
85+
@pytest.mark.xfail(strict=True)
86+
def test_missing_json_description_allowed():
87+
"""
88+
Ensure that missing descriptions in the JSON form are supported.
89+
90+
Raised as https://github.com/Midnighter/structurizr-python/issues/40, it is
91+
permitted through the Structurizr UI to create views with a blank description,
92+
which then gets ommitted from the workspace JSON, so this needs to be allowed by
93+
the Pydantic validation also.
94+
"""
95+
96+
json = """
97+
{
98+
"key": "System1-SystemContext"
99+
}
100+
"""
101+
ViewIO.parse_raw(json) # Fails as description is missing

0 commit comments

Comments
 (0)