Comments (9)
@evgeni-nabokov I've created timheuer/alexa-skills-dotnet#183 to support this request
from alexa.net.apl.
@evgeni-nabokov The latest update to Alexa.NET.APL fixes the issue with container data not being data bound, so your example should now work: https://www.nuget.org/packages/Alexa.NET.APL/4.6.0
from alexa.net.apl.
Hi @evgeni-nabokov - you can store that JSON wherever is easiest for you and then use JSON.Net to produce the document.
I use it to run a lot of my tests, so example code is available here:
https://github.com/stoiveyp/Alexa.NET.APL/blob/master/Alexa.NET.APL.Tests/Utility.cs#L26
from alexa.net.apl.
@stoiveyp I do not like an extra deserialization/serialization round, because it is a redundant operation. Ok, I can live with it for a while, but I am having the trouble with deserialization of layout with a container with data field containing data binding expression. The field is simply discarded. How to solve the problem?
from alexa.net.apl.
@evgeni-nabokov it's difficult for me to help you without the code you're having trouble with - do you have an example you could show me?
from alexa.net.apl.
@stoiveyp It is not full my code, but very essence. Likely I will remove it from here later.
My layout works well -- validated by online authoring tool.
C#
var document = new APLDocument
{
MainTemplate = JsonHelper.DeserializeFileContent<Layout>(Path.Combine("UI", screen.ToString(), "MainLayout.json")).AsMain(),
Layouts = JsonHelper.DeserializeFileContent<Dictionary<string, Layout>>(Path.Combine("UI", screen.ToString(), "Layouts.json")),
Resources = JsonHelper.DeserializeFileContent<List<Resource>>(Path.Combine("UI", "Common", "Resources.json")),
Styles = JsonHelper.DeserializeFileContent<Dictionary<string, Style>>(Path.Combine("UI", "Common", "Styles.json")),
};
document.AddResponsiveDesign();
document.Version = APLDocumentVersion.V1_2;
MainLayout.json
{
"items": [
{
"type": "Container",
"items": [
// ...
{
"type": "Container",
"direction": "row",
"paddingLeft": 20,
"paddingRight": 20,
"height": "66vh",
"width": "100%",
"items": [
{
"type": "IssueListItem",
"thumbnail": "${data.thumbnail}",
"title": "{data.title}",
"date": "{data.date}"
}
],
"data": "${payload.data.issues}" // <---------- Is not deserialized because Container has the data property of the Dictionary type.
}
],
"height": "100vh",
"width": "100vw"
}
]
}
from alexa.net.apl.
I do not see the benefits of making layout in C# as Alexa.NET.APL offers. We have online authoring tool that produces JSON layout. Why do we need do extra job converting JSON into C# every time when we change layouts?
from alexa.net.apl.
@evgeni-nabokov thank you for pointing out the problem with the container object. I'll raise a seperate issue specifically for that when I'm at a computer.
Can I ask why you're using the library for your response you have such strong views against what it does? This feels like you might be better off with the enhanced request object and a custom directive that can send raw JSON? Would that be of more use to you if it were available?
from alexa.net.apl.
I am learning Alexa and APL. I have chosen Alexa.NET.APL because I have already used Alexa.NET. Despite some imperfection, I find the library useful. For example, I like the way of building DataSources for the document. As of custom directive, I think it is a good idea. Using that directive I can combine JSON layout and typed DataSources. I may develop it further.
from alexa.net.apl.
Related Issues (20)
- Data property on Sequence is a List<object> HOT 7
- Parameters are now a string rather than an object with name property HOT 5
- Events should be an array HOT 3
- Properties that are currently APLAbsoluteDimensionValue prevent using expressions HOT 1
- Safe Updates to APL Versions with HOT 2
- Container "Data" property cant be data bound
- No ListDataSource HOT 4
- Add opacity to APLcomponent HOT 1
- Filling ListDataSource with Data HOT 1
- How to build "Karaoke Mode" and survive HOT 4
- StyleValue has an empty constructor with a parameter HOT 1
- APLComponent.When has wrong type HOT 2
- Question: How to add APL support in Azure Functions? HOT 2
- Component should implement IEnumerable<IComponent> HOT 2
- Question: How to use APL and data files from Alexa designer? HOT 10
- Setting slot values from UserEventRequest HOT 2
- Improve readme around referencing saved APL Docs HOT 1
- Container item array is serialized as a single item HOT 1
- Alexa headline footer does not work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alexa.net.apl.