Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

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

Open
djsjr opened this issue Oct 15, 2021 · 1 comment
Open

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

djsjr opened this issue Oct 15, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@djsjr
Copy link

djsjr commented Oct 15, 2021

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.

@wizage
Copy link
Contributor

wizage commented Oct 18, 2021

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.

@wizage wizage added the bug Something isn't working label Oct 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants