Skip to content

Commit fde8dc6

Browse files
committed
Make explicit the data...base
1 parent 604ed54 commit fde8dc6

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

crates/policy/src/lib.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,30 @@ impl Entrypoints {
8686
}
8787
}
8888

89-
#[derive(Serialize, Debug)]
89+
#[derive(Debug)]
9090
pub struct Data {
91+
base: BaseData,
92+
93+
// We will merge this in a custom way, so don't emit as part of the base
94+
rest: Option<serde_json::Value>,
95+
}
96+
97+
#[derive(Serialize, Debug)]
98+
struct BaseData {
9199
server_name: String,
92100

93101
/// Limits on the number of application sessions that each user can have
94102
session_limit: Option<SessionLimitConfig>,
95-
96-
// We will merge this in a custom way, so don't emit as part of the base
97-
#[serde(skip)]
98-
rest: Option<serde_json::Value>,
99103
}
100104

101105
impl Data {
102106
#[must_use]
103107
pub fn new(server_name: String, session_limit: Option<SessionLimitConfig>) -> Self {
104108
Self {
105-
server_name,
106-
session_limit,
109+
base: BaseData {
110+
server_name,
111+
session_limit,
112+
},
107113

108114
rest: None,
109115
}
@@ -116,7 +122,7 @@ impl Data {
116122
}
117123

118124
fn to_value(&self) -> Result<serde_json::Value, anyhow::Error> {
119-
let base = serde_json::to_value(self)?;
125+
let base = serde_json::to_value(&self.base)?;
120126

121127
if let Some(rest) = &self.rest {
122128
merge_data(base, rest.clone())

0 commit comments

Comments
 (0)