Skip to content

Commit 81007a1

Browse files
committed
hanges
1 parent 392df82 commit 81007a1

File tree

1 file changed

+27
-8
lines changed
  • codex-rs/app-server-protocol/src/protocol

1 file changed

+27
-8
lines changed

codex-rs/app-server-protocol/src/protocol/v2.rs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub enum ConfigLayerName {
164164
}
165165

166166
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema, TS)]
167-
#[serde(rename_all = "snake_case")]
167+
#[serde(rename_all = "camelCase")]
168168
#[ts(export_to = "v2/")]
169169
pub struct SandboxWorkspaceWrite {
170170
#[serde(default)]
@@ -178,17 +178,17 @@ pub struct SandboxWorkspaceWrite {
178178
}
179179

180180
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
181-
#[serde(rename_all = "snake_case")]
181+
#[serde(rename_all = "camelCase")]
182182
#[ts(export_to = "v2/")]
183-
pub struct Tools {
183+
pub struct ToolsV2 {
184184
pub web_search: Option<bool>,
185185
pub view_image: Option<bool>,
186186
}
187187

188188
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
189-
#[serde(rename_all = "snake_case")]
189+
#[serde(rename_all = "camelCase")]
190190
#[ts(export_to = "v2/")]
191-
pub struct Profile {
191+
pub struct ProfileV2 {
192192
pub model: Option<String>,
193193
pub model_provider: Option<String>,
194194
#[serde(
@@ -204,7 +204,7 @@ pub struct Profile {
204204
}
205205

206206
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
207-
#[serde(rename_all = "snake_case")]
207+
#[serde(rename_all = "camelCase")]
208208
#[ts(export_to = "v2/")]
209209
pub struct Config {
210210
pub model: Option<String>,
@@ -227,10 +227,10 @@ pub struct Config {
227227
pub sandbox_workspace_write: Option<SandboxWorkspaceWrite>,
228228
pub forced_chatgpt_workspace_id: Option<String>,
229229
pub forced_login_method: Option<ForcedLoginMethod>,
230-
pub tools: Option<Tools>,
230+
pub tools: Option<ToolsV2>,
231231
pub profile: Option<String>,
232232
#[serde(default)]
233-
pub profiles: HashMap<String, Profile>,
233+
pub profiles: HashMap<String, ProfileV2>,
234234
pub instructions: Option<String>,
235235
pub developer_instructions: Option<String>,
236236
pub compact_prompt: Option<String>,
@@ -1823,6 +1823,25 @@ mod tests {
18231823
);
18241824
}
18251825

1826+
#[test]
1827+
fn config_tools_deserializes_with_snake_case_keys() {
1828+
let config: Config = serde_json::from_value(json!({
1829+
"tools": {
1830+
"web_search": true,
1831+
"view_image": false
1832+
}
1833+
}))
1834+
.unwrap();
1835+
1836+
assert_eq!(
1837+
config.tools,
1838+
Some(Tools {
1839+
web_search: Some(true),
1840+
view_image: Some(false),
1841+
})
1842+
);
1843+
}
1844+
18261845
#[test]
18271846
fn codex_error_info_serializes_http_status_code_in_camel_case() {
18281847
let value = CodexErrorInfo::ResponseTooManyFailedAttempts {

0 commit comments

Comments
 (0)