google / google/googleapis.dart

YouTubeApi's VideoListResponse.toJson does not correctly serialize items

Open
#438 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
419
Forks
136
Avg merge
1h 21m
Merged PRs (30d)
5

Description

In googleapis 0.9.1, serialization to Json does not correctly convert items to Json. Is this intentional? The same goes for Channel's contentDetails.

```dart
VideoListResponse.fromJson(core.Map _json)
: this(
etag: _json.containsKey('etag') ? _json['etag'] as core.String : null,
eventId: _json.containsKey('eventId')
? _json['eventId'] as core.String
: null,
items: _json.containsKey('items')
? (_json['items'] as core.List)
.map((value) => Video.fromJson(
value as core.Map))
.toList()
: null,
...
);

core.Map toJson() => {
if (etag != null) 'etag': etag!,
if (eventId != null) 'eventId': eventId!,
// This should probably be something like `items.map((item) => item.toJson())`
if (items != null) 'items': items!,
...
};
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.