awslabs / amplify-video

An open source Category Plugin for the AWS Amplify-CLI that makes it easy to deploy live and file based streaming video services and integrate them into your Amplify applications.
https://www.npmjs.com/package/amplify-category-video
Apache License 2.0
267 stars 56 forks source link

Video object lost when VodAsset json is parsed into VodAsset object #321

Open djsjr opened 2 years ago

djsjr commented 2 years ago

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):

Smartphone (please complete the following information):

Additional context This did not used to happen.

wizage commented 2 years ago

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.