Skip to content

Commit

Permalink
Fix bug when JsonKey.includeToJson is false (#1281)
Browse files Browse the repository at this point in the history
Fixes #1280
  • Loading branch information
kevmoo authored Feb 1, 2023
1 parent 8f31d52 commit d49a5f2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
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.

0 comments on commit d49a5f2

Please sign in to comment.