Skip to content

Commit 48ed59f

Browse files
committed
fix(ContainerView): preserve externalSoftwareSystemBoundariesVisible flag in JSON (issue #67)
1 parent da9dafd commit 48ed59f

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Next Release
66
------------
77
* Fix: Don't duplicate relationships if ``add_nearest_neighbours()`` called twice (#63)
88
* Fix: Support blank diagrams descriptions from the Structurizr UI (#40)
9+
* Fix: External boundaries visible flag in ContainerView now preserved in JSON (#67)
910

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

src/structurizr/view/container_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ContainerViewIO(StaticViewIO):
3939
"""
4040

4141
external_software_system_boundary_visible: bool = Field(
42-
default=True, alias="externalSoftwareSystemBoundariesVisible"
42+
alias="externalSoftwareSystemBoundariesVisible"
4343
)
4444

4545

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# https://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
13+
14+
"""Ensure the expected behaviour of DeploymentView."""
15+
16+
17+
from structurizr.view.container_view import ContainerView, ContainerViewIO
18+
19+
20+
def test_external_system_boundary_preserved():
21+
"""Test the externalSoftwareSystemBoundariesVisible flag appears in the JSON.
22+
Not having this set means that Structurizr assumes it is false (see
23+
https://github.com/Midnighter/structurizr-python/issues/67). When exported
24+
from Structurizr, the flag is present whether true or false, so check that
25+
is also the case here.
26+
"""
27+
view = ContainerView(
28+
key="key",
29+
description="description",
30+
external_software_system_boundary_visible=True,
31+
)
32+
json = ContainerViewIO.from_orm(view).json()
33+
assert '"externalSoftwareSystemBoundariesVisible": true' in json
34+
35+
view = ContainerView(
36+
key="key",
37+
description="description",
38+
external_software_system_boundary_visible=False,
39+
)
40+
json = ContainerViewIO.from_orm(view).json()
41+
assert '"externalSoftwareSystemBoundariesVisible": false' in json

0 commit comments

Comments
 (0)