loopbackio / loopbackio/loopback-next

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

Open
#3,288 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

developer-experience feature good first issue Hacktoberfest help wanted
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

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 https://github.com/strongloop/loopback-next/issues/3288#issuecomment-507628571

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read packages/cli/generators/service/index.js and the corresponding unknown-connector handling in packages/cli/generators/repository/index.js. Then inspect packages/cli/test/integration/generators/remote-service.integration.js and the repository integration test for its test structure. Done means the service generator accepts an unknown connector and the integration test verifies that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, testing-qa, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.