-
Notifications
You must be signed in to change notification settings - Fork 412
Introduced ignore attribute to JsonKey. #114
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
Introduced ignore attribute to JsonKey. #114
Conversation
Use import aliases
...and ensure pubspec/readme consistency with a test
We always want this code to be usable outside the repo since it's referenced directly.
* Added a new method: jsonPartBuilder - so folks don't need to reference source_gen * Deprecated generators.dart in favor of json_serializable.dart
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
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.
You'll have to add a dependency_override on json_serializable
to `get the latest annotation
dependency_overrides:
json_annotation:
path: ../json_annotation
@@ -315,10 +320,11 @@ void $toJsonMapHelperName(String key, dynamic value) { | |||
} | |||
|
|||
/// Returns the set of fields that are not written to via constructors. | |||
Set<FieldElement> _writeFactory( | |||
_writeFactory( |
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.
change this to void
Please add tests for this as well – even just changing one of the examples in in |
…github.com/AlexanderJohr/json_serializable into ignore-private-and-ignore-annotated-fields
Ok, I will run the tests soon on a non-windows machine soon and fix them and also add new ones for the ignore feature. But apart from that, do you have feedback for me regarding my questions at the end of my pull request comment? |
Looking better – check out this guy - https://travis-ci.org/dart-lang/json_serializable/jobs/352621359#L561 |
@kevmoo Yes, looking into it this weekend! |
…including final fields set in the constructor parameter list but excluding other final fields.
…sures the final field 'a' that is set in the constructor is included in the factory and in toJson. Added test 'excludes final field in toJson when not set in ctor' which ensures that the same field is excluded in factory and toJson if it isn't set in the constructor.
I fixed the bugs and made the tests run green. |
Sorry, I oversaw that dartfmt needs to be run on that one file. |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
I had to rewrite the git history because I committed on different systems with different email addresses without noticing. I thought this would remove the CLA waring but it seems that it made it worse. Should I just fork again, apply the changes and create a new Pull Request with the same Github user? |
That's fine! |
Created new Pull Request with CLA signed commit authors: #118 |
Hello Kevin Moore, from all the serialization libraries for dart out there, yours was always my favorite. But for me, it was lacking 2 major features: an ignore annotation and keep initial values if the deserialized field is null. I created two branches in this fork which include these features. With them, it's all I wanted from a serialization library for dart for a long time and I use it with joy already, but I want to share my joy with the community.
I want to add examples, tests, how to guides in the readme and so on. I also have to run the tests, which is difficult for me under windows, because the tools don't work so well and I'm lacking time to do it on Linux.
The reason for those pull requests is that I want to get in touch with you first and get feedback on how to change or rename certain things.
This pull request is for the ignore attribute for JsonKey. When set to true the generator excludes the field.
What is also does is:
What I want to know is, if you recommend: