Skip to content

Commit 17a4b1b

Browse files
committed
Make all 'Unknown' variants hidden
We only have 'Unknown' variants in enums that are marked non-exhaustive. As such, there really is no point in singling out and treating special such variants: it does not matter if something is formally unknown by the apca crate itself or just unknown by the client application, both cases basically have to be treated similarly. At the same time, many of said enums can be used in input positions, where the Unknown variant simply has no place. As such, this change marks this variant as hidden. Its main purpose, thus, is to prevent potentially fatal (in a long running service) deserialization failures in otherwise legitimate responses.
1 parent 7ed4a84 commit 17a4b1b

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

src/api/v2/account.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ pub enum Status {
5858
/// Any other account status that we have not accounted for.
5959
///
6060
/// Note that having any such status should be considered a bug.
61-
#[serde(other)]
61+
#[doc(hidden)]
62+
#[serde(other, rename(serialize = "unknown"))]
6263
Unknown,
6364
}
6465

src/api/v2/account_activities.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ pub enum ActivityType {
143143
/// Any other activity type that we have not accounted for.
144144
///
145145
/// Note that having any such type should be considered a bug.
146-
#[serde(other)]
146+
#[doc(hidden)]
147+
#[serde(other, rename(serialize = "unknown"))]
147148
Unknown,
148149
}
149150

src/api/v2/asset.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub enum Class {
4646
///
4747
/// Note that having any such unknown asset class should be considered
4848
/// a bug.
49+
#[doc(hidden)]
4950
#[serde(other, rename(serialize = "unknown"))]
5051
Unknown,
5152
}
@@ -101,6 +102,7 @@ pub enum Status {
101102
///
102103
/// Note that having any such unknown asset class should be considered
103104
/// a bug.
105+
#[doc(hidden)]
104106
#[serde(other, rename(serialize = "unknown"))]
105107
Unknown,
106108
}
@@ -278,7 +280,8 @@ pub enum Exchange {
278280
///
279281
/// Note that having any such unknown exchange should be considered a
280282
/// bug.
281-
#[serde(other)]
283+
#[doc(hidden)]
284+
#[serde(other, rename(serialize = "unknown"))]
282285
Unknown,
283286
}
284287

src/api/v2/order.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ pub enum Status {
120120
/// Any other status that we have not accounted for.
121121
///
122122
/// Note that having any such status should be considered a bug.
123+
#[doc(hidden)]
123124
#[serde(other, rename(serialize = "unknown"))]
124125
Unknown,
125126
}

src/api/v2/updates.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ pub enum OrderStatus {
104104
/// Any other status that we have not accounted for.
105105
///
106106
/// Note that having any such status should be considered a bug.
107+
#[doc(hidden)]
107108
#[serde(other, rename(serialize = "unknown"))]
108109
Unknown,
109110
}

0 commit comments

Comments
 (0)