File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,9 @@ mod error {
115
115
source : serde_json:: Error ,
116
116
} ,
117
117
118
+ #[ snafu( display( "Error interpreting JSON value as API model: {}" , source) ) ]
119
+ InterpretModel { source : serde_json:: Error } ,
120
+
118
121
#[ snafu( display(
119
122
"Error deserializing command output as JSON from {}: '{}' ;: input: {}" ,
120
123
generator,
@@ -209,10 +212,17 @@ where
209
212
. context ( error:: GetPrefixSnafu { prefixes } ) ?;
210
213
debug ! ( "API response model: {}" , response. to_string( ) ) ;
211
214
215
+ // Build a Settings struct from the response.
216
+ let settings = serde_json:: from_value :: < model:: Model > ( response)
217
+ . context ( error:: InterpretModelSnafu ) ?
218
+ . settings ;
219
+
220
+ let settings_json = serde_json:: to_value ( settings) . context ( error:: SerializeRequestSnafu ) ?;
221
+
212
222
// Serialize the response json into key/value pairs. This builds the dotted string
213
223
// representation of the setting
214
224
let settings_keypairs =
215
- to_pairs_with_prefix ( "settings" , & response ) . context ( error:: SerializeSettingsSnafu ) ?;
225
+ to_pairs_with_prefix ( "settings" , & settings_json ) . context ( error:: SerializeSettingsSnafu ) ?;
216
226
217
227
// Put the setting into our hashset of populated keys
218
228
for ( k, _) in settings_keypairs {
You can’t perform that action at this time.
0 commit comments