-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to deserialize sample RenderDocument #29
Comments
@NiteLordz thanks for raising this - I've resolved the deserialization issue in 2.1.0 which is now in NuGet. There was a secondary issue with the long text example as the library didn't support simple parameters, that's been fixed as well. Hope this helps. |
@stoiveyp sample serialized render document directive below {"document":{"type":"APL","version":"1.0","theme":"dark","import":[{"name":"alexa-layouts","version":"1.0.0"}],"resources":[{"description":"Stock color for the light theme","colors":{"colorTextPrimary":"#151920"}},{"description":"Stock color for the dark theme","when":"${viewport.theme == 'dark'}","colors":{"colorTextPrimary":"#f0f1ef"}},{"description":"Standard font sizes","dimensions":{"textSizeBody":48,"textSizePrimary":27,"textSizeSecondary":23,"textSizeSecondaryHint":25}},{"description":"Common spacing values","dimensions":{"spacingThin":6,"spacingSmall":12,"spacingMedium":24,"spacingLarge":48,"spacingExtraLarge":72}},{"description":"Common margins and padding","dimensions":{"marginTop":40,"marginLeft":60,"marginRight":60,"marginBottom":40}}],"styles":{"textStyleBase":{"description":"Base font description; set color and core font family","values":[{"color":"@colorTextPrimary","fontFamily":"Amazon Ember"}]},"textStyleBase0":{"description":"Thin version of basic font","extend":"textStyleBase","values":{"fontWeight":"100"}},"textStyleBase1":{"description":"Light version of basic font","extend":"textStyleBase","values":{"fontWeight":"300"}},"mixinBody":{"values":{"fontSize":"@textSizeBody"}},"mixinPrimary":{"values":{"fontSize":"@textSizePrimary"}},"mixinSecondary":{"values":{"fontSize":"@textSizeSecondary"}},"textStylePrimary":{"extend":["textStyleBase1","mixinPrimary"]},"textStyleSecondary":{"extend":["textStyleBase0","mixinSecondary"]},"textStyleBody":{"extend":["textStyleBase1","mixinBody"]},"textStyleSecondaryHint":{"values":{"fontFamily":"Bookerly","fontStyle":"italic","fontSize":"@textSizeSecondaryHint","color":"@colorTextPrimary"}}},"layouts":{},"mainTemplate":{"parameters":["payload"],"items":[{"when":"${viewport.shape == 'round'}","type":"Container","direction":"column","items":[{"type":"Image","source":"${payload.bodyTemplate7Data.backgroundImage.sources[0].url}","scale":"best-fill","position":"absolute","width":"100vw","height":"100vh"},{"type":"AlexaHeader","headerTitle":"${payload.bodyTemplate7Data.title}","headerAttributionImage":"${payload.bodyTemplate7Data.logoUrl}"},{"type":"Container","grow":1,"alignItems":"center","justifyContent":"center","items":[{"type":"Image","source":"${payload.bodyTemplate7Data.image.sources[0].url}","scale":"best-fill","width":"100vh","height":"70vw","align":"center"}]}]},{"type":"Container","items":[{"type":"Image","source":"${payload.bodyTemplate7Data.backgroundImage.sources[0].url}","scale":"best-fill","position":"absolute","width":"100vw","height":"100vh"},{"type":"AlexaHeader","headerTitle":"${payload.bodyTemplate7Data.title}","headerAttributionImage":"${payload.bodyTemplate7Data.logoUrl}"},{"type":"Container","direction":"row","paddingLeft":"5vw","paddingRight":"5vw","paddingBottom":"5vh","alignItems":"center","justifyContent":"center","items":[{"type":"Image","height":"75vh","width":"90vw","source":"${payload.bodyTemplate7Data.image.sources[0].url}","scale":"best-fill","align":"center"}]}]}]}},"dataSources":{"bodyTemplate7Data":{"type":"object","objectId":"bt7Sample","title":"Today's Daily Photo of Cheese","backgroundImage":{"contentDescription":null,"smallSourceUrl":null,"largeSourceUrl":null,"sources":[{"url":"https://d2o906d8ln7ui1.cloudfront.net/images/BT7_Background.png","size":"small","widthPixels":0,"heightPixels":0},{"url":"https://d2o906d8ln7ui1.cloudfront.net/images/BT7_Background.png","size":"large","widthPixels":0,"heightPixels":0}]},"image":{"contentDescription":null,"smallSourceUrl":null,"largeSourceUrl":null,"sources":[{"url":"https://d2o906d8ln7ui1.cloudfront.net/images/MollyforBT7.png","size":"small","widthPixels":0,"heightPixels":0},{"url":"https://d2o906d8ln7ui1.cloudfront.net/images/MollyforBT7.png","size":"large","widthPixels":0,"heightPixels":0}]},"logoUrl":"https://d2o906d8ln7ui1.cloudfront.net/images/cheeseskillicon.png","hintText":"Try, "Alexa, search for blue cheese""}}} |
@NiteLordz This was a great example - thank you. I made the example a test file as a RenderDocumentDirective to deserialize it as a single piece - and with the failed test I was able to publish v3.0.0 |
Getting much closer!!! Am now able to deserialize the document elements, however, Data sources do not deserialize. In the unit tests, "RenderDocument.json" executes properly and has the Data Sources filled in. However, if you substitute "KeefersExample" in, you will see that the data sources are not populated. Properties element is null. This is another nested item. Holiday week has been GREAAT!!! hope yours has been as well! |
@NiteLordz This one took a little longer as it's a mismatch to the documentation and the documentation still works, so I didn't want to break it. Documentation says ObjectDataSource should honor a "properties" object for the data, but the designer is adding them dynamically at the top level. Both work - just means the path you use has I've added a TopLevelData property in 3.1.0 (just published) to allow for the designer approach, which means you can access the data in your data source through that. |
Confirmed, and databinding is occuring! #Success #CloseThisIssue Btw, send ya a twitter follow, had some other things wanted to talk to ya about, in a non GH arena lol. |
Brilliant news, thank you for sticking with it/me! I'll make sure you're on my twitter list 👍 |
If you go here and try the sample "Long text" then export the code.
when you try to deserialize that json you get an error of
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IList`1
for the property "fontWeight" as it is a single element and not a list element.
I tried to puta JsonObject attribute on the class, but it didn't resolve the issue.
The text was updated successfully, but these errors were encountered: