Skip to content
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

Fix bug when JsonKey.includeToJson is false #1281

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions json_serializable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.6.1

- Fix bug when `JsonKey.includeToJson` is `false`.

## 6.6.0

- Support for `JsonKey.includeFromJson` and `JsonKey.includeToJson`.
Expand Down
2 changes: 1 addition & 1 deletion json_serializable/lib/src/generator_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,5 @@ extension on KeyConfig {

bool get explicitYesToJson => includeToJson == true;

bool get explicitNoToJson => includeFromJson == false;
bool get explicitNoToJson => includeToJson == false;
}
2 changes: 1 addition & 1 deletion json_serializable/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: json_serializable
version: 6.6.0
version: 6.6.1
description: >-
Automatically generate code for converting to and from JSON by annotating
Dart classes.
Expand Down
20 changes: 10 additions & 10 deletions json_serializable/test/field_matrix_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ const _expectedResult = {
'without': {'aField': null, 'field': null, 'zField': null}
},
'ToJsonTrueFromJsonFalsePublic: field: null': {
'with': {'aField': null, 'zField': null},
'without': {'aField': null, 'zField': null}
'with': {'aField': null, 'field': null, 'zField': null},
'without': {'aField': null, 'field': null, 'zField': null}
},
'ToJsonFalseFromJsonNullPublic: field: 42': {
'with': {'aField': null, 'field': 42, 'zField': null},
'without': {'aField': null, 'field': null, 'zField': null}
'with': {'aField': null, 'zField': null},
'without': {'aField': null, 'zField': null}
},
'ToJsonFalseFromJsonTruePublic: field: 42': {
'with': {'aField': null, 'field': 42, 'zField': null},
'without': {'aField': null, 'field': null, 'zField': null}
'with': {'aField': null, 'zField': null},
'without': {'aField': null, 'zField': null}
},
'ToJsonFalseFromJsonFalsePublic: field: null': {
'with': {'aField': null, 'zField': null},
Expand All @@ -76,16 +76,16 @@ const _expectedResult = {
'without': {'aField': null, 'field': null, 'zField': null}
},
'ToJsonTrueFromJsonFalsePrivate: _field: null': {
'with': {'aField': null, 'zField': null},
'without': {'aField': null, 'zField': null}
'with': {'aField': null, 'field': null, 'zField': null},
'without': {'aField': null, 'field': null, 'zField': null}
},
'ToJsonFalseFromJsonNullPrivate: _field: null': {
'with': {'aField': null, 'zField': null},
'without': {'aField': null, 'zField': null}
},
'ToJsonFalseFromJsonTruePrivate: _field: 42': {
'with': {'aField': null, 'field': 42, 'zField': null},
'without': {'aField': null, 'field': null, 'zField': null}
'with': {'aField': null, 'zField': null},
'without': {'aField': null, 'zField': null}
},
'ToJsonFalseFromJsonFalsePrivate: _field: null': {
'with': {'aField': null, 'zField': null},
Expand Down
5 changes: 2 additions & 3 deletions json_serializable/test/field_matrix_test.field_matrix.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.