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
Crash serializing json_serializable objects #374
Comments
I just worked around this issue by pre .toJson()'ing my json_serializable model classes first...
|
https://api.dartlang.org/stable/2.4.0/dart-convert/jsonEncode.html
So we shoud add the default behavior to our encoder |
I should add, this method potentially generates an absurdly long key. What you should be doing is taking a hash of the string and using that as the key. |
@lookfirst I think we could even just use |
Please try |
@micimize Confirmed! Thanks for the hard work. One question, why not also fix the code that builds the key to be a shorter string (ie: hash)? |
@lookfirst want to do it carefully - made an issue though #400. For instance, I realized I was misunderstanding Would also be good to see exactly how apollo implements it, although it might be irrelevant because they do client-side query-resolution. |
https://pchalin.blogspot.com/2014/04/defining-equality-and-hashcode-for-dart.html apparently quiver has hash functions. |
Oh man, this sent me down a rabbit hole: https://medium.com/booking-com-development/hardening-perls-hash-function-d642601f4e54 I wonder if there are any potential attacks against software as a result of using the quiver hash functions. |
Oh, it just keeps going... dart-lang/sdk#11617 |
Included package: graphql client V2.0.1
I'm using one of my model objects as variables for a mutation. I am passing in List of these objects as a graphql variable. For some reason, in
raw_operation_data.dart:toKey()
,json.encoder()
is crashing with this error:As you can see, if I remove the
toEncodable
, things work just fine:Any ideas?
I do have toJson and fromJson methods in the object, which are just proxies for the stuff generated by
json_serializable
.The text was updated successfully, but these errors were encountered: