-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(spells): do json manipulations internally #1433
Conversation
@@ -66,7 +66,7 @@ pub(crate) async fn spell_install( | |||
services.call_function( | |||
&spell_id, | |||
"set_json_fields", | |||
vec![json!(init_data)], | |||
vec![json!(init_data.to_string())], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be enough to pass init_data.to_string()
? If not, why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call_function accepts function_args: Vec<JValue>
process_func_outcome::<UnitValue>( | ||
services.call_function( | ||
spell_id, | ||
"set_json_fields", | ||
args.function_args.clone(), | ||
vec![json!(response.to_string())], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing, why do you serialize it to json twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set_json_fields accepts string that can be parsed to json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
response.to_string()
seems to satisfy that description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but call_function
accepts function_args: Vec<JValue>
getDataSrv
returns parsed json value, so there is no need to parse it manuallyspell.install
now accepts any object asinit_data
(previously, it was accepting only stringified ones)response
accepts objects (previously, it was accepting only stringified ones)