Skip to content

Commit

Permalink
Add support for complex data formats for Node-RED flow generator
Browse files Browse the repository at this point in the history
  • Loading branch information
ipamaas committed May 22, 2020
1 parent 4a579c0 commit aec2c40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/utility/generators/MsbClientGeneratorNodeRed.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ export default class MsbClientGeneratorNodeRed extends MsbClientGenerator {
settings.msbObjectNodeId = uuidv4()
settings.debugNodeId = uuidv4()

// TODO: Support complex objects in events an functions
// remove complex events
events = this.removeEventsOrFunctionsWithComplexObjects(events)
// remove complex functions
functions = this.removeEventsOrFunctionsWithComplexObjects(functions)

// TODO: Support no payload in events an functions
// fix events with no payload
events = this.fixDataFormatWithNoPayload(events)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
<%# TODO: Add support for complex objects -%>
{
"name": "<%= event.eventId -%>",
"dataTypeName": "<%- (event.dataFormat.dataObject.format ? event.dataFormat.dataObject.format : event.dataFormat.dataObject.type) -%>"
"dataTypeName": "<%- (event.dataFormat.dataObject.format ? event.dataFormat.dataObject.format : (event.dataFormat.dataObject.type ? event.dataFormat.dataObject.type : 'object')) -%>",
"schema": <%- ((!event.dataFormat.dataObject.type || event.dataFormat.dataObject.type === 'object') ? JSON.stringify(JSON.stringify(event.dataFormat)) : '""' ) %>
}<%= (events[events.length-1].eventId != event.eventId) ? "," : "" %>
<% }) -%>
<% } -%>
Expand All @@ -39,7 +40,8 @@
<%# TODO: Add support for complex objects -%>
{
"name": "<%= func.functionId -%>",
"dataTypeName": "<%- (func.dataFormat.dataObject.format ? func.dataFormat.dataObject.format : func.dataFormat.dataObject.type) -%>",
"dataTypeName": "<%- (func.dataFormat.dataObject.format ? func.dataFormat.dataObject.format : (func.dataFormat.dataObject.type ? func.dataFormat.dataObject.type : 'object')) -%>",
"schema": <%- ((!func.dataFormat.dataObject.type || func.dataFormat.dataObject.type === 'object') ? JSON.stringify(JSON.stringify(func.dataFormat)) : '""' ) -%>,
"output": "<%= index + 1 -%>"
}<%= (functions[functions.length-1].functionId != func.functionId) ? "," : "" %>
<% }) -%>
Expand Down

0 comments on commit aec2c40

Please sign in to comment.