Code Monkey home page Code Monkey logo

Comments (9)

stoiveyp avatar stoiveyp commented on September 24, 2024 1

@evgeni-nabokov I've created timheuer/alexa-skills-dotnet#183 to support this request

from alexa.net.apl.

stoiveyp avatar stoiveyp commented on September 24, 2024 1

@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.

stoiveyp avatar stoiveyp commented on September 24, 2024

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.

evgeni-nabokov avatar evgeni-nabokov commented on September 24, 2024

@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.

stoiveyp avatar stoiveyp commented on September 24, 2024

@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.

evgeni-nabokov avatar evgeni-nabokov commented on September 24, 2024

@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.

evgeni-nabokov avatar evgeni-nabokov commented on September 24, 2024

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.

stoiveyp avatar stoiveyp commented on September 24, 2024

@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.

evgeni-nabokov avatar evgeni-nabokov commented on September 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.