@@ -163,102 +163,80 @@ pub enum ConfigLayerName {
163163}
164164
165165#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , Default , JsonSchema , TS ) ]
166- #[ serde( rename_all = "camelCase " ) ]
166+ #[ serde( rename_all = "snake_case " ) ]
167167#[ ts( export_to = "v2/" ) ]
168168pub struct SandboxWorkspaceWrite {
169- #[ serde( default , alias = "writable_roots" ) ]
169+ #[ serde( default ) ]
170170 pub writable_roots : Vec < PathBuf > ,
171- #[ serde( default , alias = "network_access" ) ]
171+ #[ serde( default ) ]
172172 pub network_access : bool ,
173- #[ serde( default , alias = "exclude_tmpdir_env_var" ) ]
173+ #[ serde( default ) ]
174174 pub exclude_tmpdir_env_var : bool ,
175- #[ serde( default , alias = "exclude_slash_tmp" ) ]
175+ #[ serde( default ) ]
176176 pub exclude_slash_tmp : bool ,
177177}
178178
179179#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
180- #[ serde( rename_all = "camelCase " ) ]
180+ #[ serde( rename_all = "snake_case " ) ]
181181#[ ts( export_to = "v2/" ) ]
182182pub struct ToolsV2 {
183- #[ serde( alias = "web_search" ) ]
184183 pub web_search : Option < bool > ,
185- #[ serde( alias = "view_image" ) ]
186184 pub view_image : Option < bool > ,
187185}
188186
189187#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
190- #[ serde( rename_all = "camelCase " ) ]
188+ #[ serde( rename_all = "snake_case " ) ]
191189#[ ts( export_to = "v2/" ) ]
192190pub struct ProfileV2 {
193191 pub model : Option < String > ,
194- #[ serde( alias = "model_provider" ) ]
195192 pub model_provider : Option < String > ,
196193 #[ serde(
197194 default ,
198195 deserialize_with = "deserialize_approval_policy" ,
199- serialize_with = "serialize_approval_policy" ,
200- alias = "approval_policy"
196+ serialize_with = "serialize_approval_policy"
201197 ) ]
202198 pub approval_policy : Option < AskForApproval > ,
203- #[ serde( alias = "model_reasoning_effort" ) ]
204199 pub model_reasoning_effort : Option < ReasoningEffort > ,
205- #[ serde( alias = "model_reasoning_summary" ) ]
206200 pub model_reasoning_summary : Option < ReasoningSummary > ,
207- #[ serde( alias = "model_verbosity" ) ]
208201 pub model_verbosity : Option < Verbosity > ,
209- #[ serde( alias = "chatgpt_base_url" ) ]
210202 pub chatgpt_base_url : Option < String > ,
211203}
212204
213205#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
214- #[ serde( rename_all = "camelCase " ) ]
206+ #[ serde( rename_all = "snake_case " ) ]
215207#[ ts( export_to = "v2/" ) ]
216208pub struct Config {
217209 pub model : Option < String > ,
218- #[ serde( alias = "review_model" ) ]
219210 pub review_model : Option < String > ,
220- #[ serde( alias = "model_context_window" ) ]
221211 pub model_context_window : Option < i64 > ,
222- #[ serde( alias = "model_auto_compact_token_limit" ) ]
223212 pub model_auto_compact_token_limit : Option < i64 > ,
224- #[ serde( alias = "model_provider" ) ]
225213 pub model_provider : Option < String > ,
226214 #[ serde(
227215 default ,
228216 deserialize_with = "deserialize_approval_policy" ,
229- serialize_with = "serialize_approval_policy" ,
230- alias = "approval_policy"
217+ serialize_with = "serialize_approval_policy"
231218 ) ]
232219 pub approval_policy : Option < AskForApproval > ,
233220 #[ serde(
234221 default ,
235222 deserialize_with = "deserialize_sandbox_mode" ,
236- serialize_with = "serialize_sandbox_mode" ,
237- alias = "sandbox_mode"
223+ serialize_with = "serialize_sandbox_mode"
238224 ) ]
239225 pub sandbox_mode : Option < SandboxMode > ,
240- #[ serde( alias = "sandbox_workspace_write" ) ]
241226 pub sandbox_workspace_write : Option < SandboxWorkspaceWrite > ,
242- #[ serde( alias = "forced_chatgpt_workspace_id" ) ]
243227 pub forced_chatgpt_workspace_id : Option < String > ,
244- #[ serde( alias = "forced_login_method" ) ]
245228 pub forced_login_method : Option < ForcedLoginMethod > ,
246229 pub tools : Option < ToolsV2 > ,
247230 pub profile : Option < String > ,
248231 #[ serde( default ) ]
249232 pub profiles : HashMap < String , ProfileV2 > ,
250233 pub instructions : Option < String > ,
251- #[ serde( alias = "developer_instructions" ) ]
252234 pub developer_instructions : Option < String > ,
253- #[ serde( alias = "compact_prompt" ) ]
254235 pub compact_prompt : Option < String > ,
255- #[ serde( alias = "model_reasoning_effort" ) ]
256236 pub model_reasoning_effort : Option < ReasoningEffort > ,
257- #[ serde( alias = "model_reasoning_summary" ) ]
258237 pub model_reasoning_summary : Option < ReasoningSummary > ,
259- #[ serde( alias = "model_verbosity" ) ]
260238 pub model_verbosity : Option < Verbosity > ,
261- #[ serde( default , flatten, deserialize_with = "deserialize_additional" ) ]
239+ #[ serde( default , flatten) ]
262240 pub additional : HashMap < String , JsonValue > ,
263241}
264242
@@ -301,38 +279,6 @@ where
301279 . serialize ( serializer)
302280}
303281
304- fn deserialize_additional < ' de , D > ( deserializer : D ) -> Result < HashMap < String , JsonValue > , D :: Error >
305- where
306- D : serde:: Deserializer < ' de > ,
307- {
308- let raw = HashMap :: < String , JsonValue > :: deserialize ( deserializer) ?;
309- Ok ( raw
310- . into_iter ( )
311- . map ( |( key, value) | ( snake_to_camel ( & key) , value) )
312- . collect ( ) )
313- }
314-
315- fn snake_to_camel ( input : & str ) -> String {
316- let mut output = String :: with_capacity ( input. len ( ) ) ;
317- let mut upper_next = false ;
318-
319- for ch in input. chars ( ) {
320- if ch == '_' {
321- upper_next = true ;
322- continue ;
323- }
324-
325- if upper_next {
326- output. push ( ch. to_ascii_uppercase ( ) ) ;
327- upper_next = false ;
328- } else {
329- output. push ( ch) ;
330- }
331- }
332-
333- output
334- }
335-
336282#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
337283#[ serde( rename_all = "camelCase" ) ]
338284#[ ts( export_to = "v2/" ) ]
@@ -1882,25 +1828,6 @@ mod tests {
18821828 ) ;
18831829 }
18841830
1885- #[ test]
1886- fn config_tools_deserializes_with_snake_case_keys ( ) {
1887- let config: Config = serde_json:: from_value ( json ! ( {
1888- "tools" : {
1889- "web_search" : true ,
1890- "view_image" : false
1891- }
1892- } ) )
1893- . unwrap ( ) ;
1894-
1895- assert_eq ! (
1896- config. tools,
1897- Some ( ToolsV2 {
1898- web_search: Some ( true ) ,
1899- view_image: Some ( false ) ,
1900- } )
1901- ) ;
1902- }
1903-
19041831 #[ test]
19051832 fn codex_error_info_serializes_http_status_code_in_camel_case ( ) {
19061833 let value = CodexErrorInfo :: ResponseTooManyFailedAttempts {
0 commit comments