project-flogo / flogo-web

Project Flogo Web UI
http://flogo.io
BSD 3-Clause "New" or "Revised" License
63 stars 36 forks source link

[Connections] Inline connections support #1331

Open fcastill opened 4 years ago

fcastill commented 4 years ago

Is your feature request related to a problem? Please describe.

This is part of #1330 Connections support

This a feature request for supporting in-line connections

Example of inline connection in app.json

"activity" : {
  "ref": "#sql",
  "settings": {
    "connection": {
      "ref" : "github.com/project-flogo/contrib/connection/sql",
      "settings" : {
        "dbType": "mysql",
        "driver": "mysql",
        "dataSource": "username:password@tcp(host:port)/dbName",
      }
    }
  }
}

To Do

Details of changes

For this iteration we don't have to validate that the attributes of the connection match with the declarations in the connection descriptor, so we don't need to add support for installing contributions of type connection. This will allow us to quickly provide basic support for connections.

We will mostly just update the mapper so if a contrib has a setting of type connection it won’t use the mapping wrapper. Also we will collect the connections refs to add them to the imports of the app during the export process.

Mapping of connections

Currently when the mapper UI infers that the user provided an value of type object it wraps the object with an attribute mapping. In order to support connections the mapper will need to first check if the attribute is of type connection and if it is then it should just store the object value provided by the user, for other types the old behavior should not be changed.

Examples:

❌ Wrong if setting foo has data type connection

"settings": {
    "foo": {
       "mapping": {
          "ref": "github.com/project-flogo/messaging-contrib/pulsar/connection",
          "settings": {
             "url": "pulsar://localhost:6650"
          }
        }
    }
},

✅ Correct if setting foo has data type connection

"settings": {
    "foo": {
        "ref": "github.com/project-flogo/messaging-contrib/pulsar/connection",
        "settings": {
           "url": "pulsar://localhost:6650"
        }
    }
},

Questions