Skip to content

Commit 41f40e1

Browse files
committed
fix: fix ToJSON instance for DiffusionMode
1 parent 12651aa commit 41f40e1

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
For top level release notes, leave all the headers commented out.
6+
-->
7+
8+
9+
### Breaking
10+
11+
- Changed ToJSON for DiffusionMode to agree with the topology file syntax. ReadJSON was already correct.
12+
13+
14+
<!--
15+
### Non-Breaking
16+
17+
- A bullet item for the Non-Breaking category.
18+
19+
-->

ouroboros-network/orphan-instances/Ouroboros/Network/OrphanInstances.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ instance FromJSON DiffusionMode where
117117
_ -> fail "Parsing NodeDiffusionMode failed: can be either 'InitiatorOnly' or 'InitiatorAndResponder'"
118118

119119
instance ToJSON DiffusionMode where
120-
toJSON = String . pack . show
120+
toJSON InitiatorOnlyDiffusionMode = "InitiatorOnly"
121+
toJSON InitiatorAndResponderDiffusionMode = "InitiatorAndResponder"
121122

122123
-- | Does not use the 'FromJSON' instance of 'RootConfig', so that
123124
-- 'accessPoints', 'advertise', 'valency' and 'warmValency' fields are attached

0 commit comments

Comments
 (0)