Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 28, 2024. It is now read-only.
This repository was archived by the owner on May 28, 2024. It is now read-only.

Table rows cannot have empty strings #250

Closed
@JamesIves

Description

@JamesIves

I ran into this the other day and it took a really long time to figure out, I'm not really sure if this is a bug or not but figured I'd bring this to your attention.

Failed to parse Dialogflow response into AppResponse

In my case I was generating a table with some data from an API endpoint like so:

consttimetableCells=timetable.Trains.map((item)=>{return{cells:[item.Line,item.Destination,item.Car,item.Min],}})conv.ask(newTable({title:`Rail Timetable for${station}`,subtitle:'Timetable as of x date',image:newImage({url:'http://google.com/image.png',alt:'Logo'}),columns:[{header:'Line',align:'LEADING'},{header:'Destination',align:'LEADING'},{header:'Car',align:'LEADING'},{header:'Arrival',align:'LEADING'},],rows:timetableCells,buttons:newButton({title:'Button Title',url:'https://github.com/actions-on-google'})}))

The returned data fromtimetable looks like this and the array I'm generating from map followed the correct schema forrows, as far as I could tell there should have been no issues as the generated JSON was valid.

{"Trains":[{"Car":"8","Destination":"Glenmont","DestinationCode":"B11","DestinationName":"Glenmont","Group":"1","Line":"RD","LocationCode":"B09","LocationName":"Forest Glen","Min":"9"},{"Car":"8","Destination":"Glenmont","DestinationCode":"B11","DestinationName":"Glenmont","Group":"1","Line":"RD","LocationCode":"B09","LocationName":"Forest Glen","Min":"18"},{"Car":"8","Destination":"Glenmont","DestinationCode":"B11","DestinationName":"Glenmont","Group":"1","Line":"RD","LocationCode":"B09","LocationName":"Forest Glen","Min":"36"},{"Car":"8","Destination":"Shady Gr","DestinationCode":"A15","DestinationName":"Shady Grove","Group":"2","Line":"RD","LocationCode":"B09","LocationName":"Forest Glen","Min":""}]}

timetableCells:

screen shot 2018-11-26 at 8 29 13 am

DialogFlow kept throwing a JSON parsing error and I couldn't seem to figure out what the issue was, it was obvious to me that the data length needed to match the headers, but what wasn't obvious was that data in row cellscannot be empty strings. Sometimes the API endpoint returns empty strings for some data that isn't available yet. I resolved the issue with the following:

consttimetableCells=timetable.Trains.map((item)=>{return{cells:[item.Line||"N/A",item.Destination||"N/A",item.Car||"TBD",item.Min||"TDB"],}})

I spent quite a long time debugging this, and I think this would be a good addition to thedocumentation if it's indeed intended and not a bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp