awslabs/amplify-video

Video object lost when VodAsset json is parsed into VodAsset object

djsjr opened this issue · 1 comments

djsjr commented

Describe the bug
When parsing a json of a vodAsset using the .fromJson method, the video object is lost and the resulting model instance has video = null.

There doesn't seem to be a 'serializedData' level to the json file as indicated in the constructor (?) that parses the json object (VodAsset.fromJson on line 127 of the model file)

This does not work:

        _video = json['video']?['serializedData'] != null
            ? VideoObject.fromJson(
                new Map<String, dynamic>.from(json['video']['serializedData']))
            : null;

This does work:

        _video = json['video'] != null
            ? VideoObject.fromJson(new Map<String, dynamic>.from(json['video']))
            : null;

To Reproduce
Steps to reproduce the behavior:

  1. Query for a VodAsset object.
  2. var data = response.data;
  3. var decodedData = jsonDecode(data);
  4. print decodedData to confirm a video within json exists. (It does.)
  5. vodAsset = VodAsset.fromJson(decodedData['getVodAsset']);
  6. print vodAsset to check if video object exists inside vodAsset instance. (it does not. Equals null).

Expected behavior
Video object should not be null.

Screenshots
n/a

Desktop (please complete the following information):

  • OS: iOS
  • n/a

Smartphone (please complete the following information):

  • Device: simulator
  • OS: iOS 14.5

Additional context
This did not used to happen.

Is this an issue with Amplify Video or the GraphQL API?

Looks like it is an issue with the objected returned from the GraphQL API. If so I would recommend cross posting this on to the Amplify iOS Repo.