Skip to content

Commit

Permalink
Records: more testing (#1320)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo authored May 16, 2023
1 parent be8e9a3 commit 755d5d3
Show file tree
Hide file tree
Showing 14 changed files with 1,098 additions and 5 deletions.
5 changes: 2 additions & 3 deletions json_annotation/lib/src/json_key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,15 @@ class JsonKey {
///
/// Only required when the default behavior is not desired.
const JsonKey({
@Deprecated('Has no effect')
bool? nullable,
@Deprecated('Has no effect') bool? nullable,
this.defaultValue,
this.disallowNullValue,
this.fromJson,
@Deprecated(
'Use `includeFromJson` and `includeToJson` with a value of `false` '
'instead.',
)
this.ignore,
this.ignore,
this.includeFromJson,
this.includeIfNull,
this.includeToJson,
Expand Down
28 changes: 28 additions & 0 deletions json_serializable/test/supported_types/input.type_iterable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,34 @@ class SimpleClassNullableOfObjectNullable {
_$SimpleClassNullableOfObjectNullableToJson(this);
}

@JsonSerializable()
class SimpleClassOfRecord {
final Iterable<(int, String, {bool truth})> value;

SimpleClassOfRecord(
this.value,
);

factory SimpleClassOfRecord.fromJson(Map<String, Object?> json) =>
_$SimpleClassOfRecordFromJson(json);

Map<String, Object?> toJson() => _$SimpleClassOfRecordToJson(this);
}

@JsonSerializable()
class SimpleClassNullableOfRecord {
final Iterable<(int, String, {bool truth})>? value;

SimpleClassNullableOfRecord(
this.value,
);

factory SimpleClassNullableOfRecord.fromJson(Map<String, Object?> json) =>
_$SimpleClassNullableOfRecordFromJson(json);

Map<String, Object?> toJson() => _$SimpleClassNullableOfRecordToJson(this);
}

@JsonSerializable()
class SimpleClassOfString {
final Iterable<String> value;
Expand Down
55 changes: 55 additions & 0 deletions json_serializable/test/supported_types/input.type_iterable.g.dart

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

28 changes: 28 additions & 0 deletions json_serializable/test/supported_types/input.type_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,34 @@ class SimpleClassNullableOfObjectNullable {
_$SimpleClassNullableOfObjectNullableToJson(this);
}

@JsonSerializable()
class SimpleClassOfRecord {
final List<(int, String, {bool truth})> value;

SimpleClassOfRecord(
this.value,
);

factory SimpleClassOfRecord.fromJson(Map<String, Object?> json) =>
_$SimpleClassOfRecordFromJson(json);

Map<String, Object?> toJson() => _$SimpleClassOfRecordToJson(this);
}

@JsonSerializable()
class SimpleClassNullableOfRecord {
final List<(int, String, {bool truth})>? value;

SimpleClassNullableOfRecord(
this.value,
);

factory SimpleClassNullableOfRecord.fromJson(Map<String, Object?> json) =>
_$SimpleClassNullableOfRecordFromJson(json);

Map<String, Object?> toJson() => _$SimpleClassNullableOfRecordToJson(this);
}

@JsonSerializable()
class SimpleClassOfString {
final List<String> value;
Expand Down
59 changes: 59 additions & 0 deletions json_serializable/test/supported_types/input.type_list.g.dart

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

Loading

0 comments on commit 755d5d3

Please sign in to comment.