You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am expecting nullable fields to allow values, my spec allows for nullable values in certain fields but when I actually run the queries I am getting an assertion error
The text was updated successfully, but these errors were encountered:
Hi, I'm facing exactly same issue.
After seeing the generated code, I figured out that it might be caused by required but nullable value as you mention.
The tool generates code like this in fromJson method:
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "SomeModel[$key]" is missing from JSON.');
assert(json[key] !=null, 'Required key "SomeModel[$key]" has a null value in JSON.'); // this code is not good. it ignores exisitence of required but nullable value.
});
returntrue;
}());
I will look into generator code and see if I can fix it.
Bug Report Checklist
Description
I am expecting nullable fields to allow values, my spec allows for nullable values in certain fields but when I actually run the queries I am getting an assertion error
The text was updated successfully, but these errors were encountered: