Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Commit

Permalink
fix(View): support blank descriptions in diagrams from the Structuriz…
Browse files Browse the repository at this point in the history
…r UI (issue #40)
  • Loading branch information
yt-ms committed Dec 27, 2020
1 parent f92e98f commit b5d7f05
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ History
Next Release
------------
* Fix: Don't duplicate relationships if ``add_nearest_neighbours()`` called twice (#63)
* Fix: Support blank diagrams descriptions from the Structurizr UI (#40)

0.3.0 (2020-11-29)
------------------
Expand Down
2 changes: 1 addition & 1 deletion src/structurizr/view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ViewIO(BaseModel, ABC):
"""

key: str
description: str
description: str = ""
software_system_id: Optional[str] = Field(default=None, alias="softwareSystemId")
paper_size: Optional[PaperSize] = Field(default=None, alias="paperSize")
automatic_layout: Optional[AutomaticLayoutIO] = Field(
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/view/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

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

import pytest

from structurizr.model import Model
from structurizr.view.view import View, ViewIO

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


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

0 comments on commit b5d7f05

Please sign in to comment.