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
All fields that are not crucial for operation of the app are not "required" to allow the app to run with as minimal information necessary. But i would always "expect" to have a first name and last name from my backend.
As long as i am in a developer environment, i would like to get informed if one of my expected fields are missing.
The example may not be the best, but you'll get the idea.
I've experienced in my projects that sometimes field names tend to be misspelled (either in frontend or backend but as they could be optional this is often overlooked during implementation), or in bigger classes data might be "optional" in a release environment that is always "expected" in a dev environment.
I do understand that this is better be caught and tested in test files, but the real world often misses the time to write those, thats why i came up with this idea.
The text was updated successfully, but these errors were encountered:
I would like to throw in a feature to discuss.
An annotation like JsonKey(expected: true) or @Expected/@optional that is purely for printing warnings if a member is missing while using .fromJson().
The idea comes from the scenario using JsonSerializable for generating data classes as REST communication objects.
An example of an user object:
I would implement this class like:
All fields that are not crucial for operation of the app are not "required" to allow the app to run with as minimal information necessary. But i would always "expect" to have a first name and last name from my backend.
As long as i am in a developer environment, i would like to get informed if one of my expected fields are missing.
The example may not be the best, but you'll get the idea.
I've experienced in my projects that sometimes field names tend to be misspelled (either in frontend or backend but as they could be optional this is often overlooked during implementation), or in bigger classes data might be "optional" in a release environment that is always "expected" in a dev environment.
I do understand that this is better be caught and tested in test files, but the real world often misses the time to write those, thats why i came up with this idea.
The text was updated successfully, but these errors were encountered: