Skip to content

lb4 service: support connectors not included in LoopBack's official list #3288

@embpdaniel

Description

@embpdaniel

Suggestion

A connector such as the sendgrid loopback connector, is a connector that does not require CRUD commands and it is not a REST data source. This currently seems to make it impossible to run the lb4 service command against such a connector, as the generator will expect a REST datasource.

My suggestion would be to add a new datasource metadata for a connector such as this (one that doesn't require CRUD and is not a REST api), so the service generator is able to recognize it as a valid datasource and make its methods available to controllers.

Use Cases

This will be useful for connecting a service to an email library such as sendgrid, or to utilize other libraries that provide a high-level API for their REST implementations. This includes just about any 3rd party library that is not controlled via REST directly.

Examples

  1. Create a sendgrid email datasource based on one of the existing sendgrid loopback connectors
  2. Run the lb4 service command, to tie this datasource to a service
  3. Inject the service into a controller, to give the user the ability to send emails based on some API request

Acceptance criteria

based on #3288 (comment)

  • Modify the logic in lb4 service and lb4 repository and when we don't have metadata about the base model used by the connector, then assume the connector is compatible with both services and repositories. Maybe print a hint that we don't know if the connector is compatible.

Hints:


🎆 Hacktoberfest 2020

Greetings 👋 to all Hacktoberfest 2020 participants!

Here are few tips 👀 to make your start easier, see also #6456:

  • Before you start working on this issue, please leave a comment to let others know.
  • If you are new to GitHub pull requests, then you can learn about the process in Submitting a pull request to LoopBack 4.
  • If this is your first contribution to LoopBack, then please take a look at our Developer guide.
  • Feel free to ask for help in #loopback-contributors channel, you can join our Slack workspace here.

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