-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lb4 service: support connectors not included in LoopBack's official list #3288
Comments
At the moment, we use |
@raymondfeng the problem is that the sendgrid connector is not listed in available-connectors file. IMO, it's not reasonable to expect all community-maintained connectors to be listed in that file. For the short term, I am proposing to modify the logic in I think the first part can be easily accomplished by changing the following line to return For longer term, I think we should replace available-connectors file with a decentralized approach:
|
Any Solution regarding this. Stuck in sending email using sendgrid in loopback 4 |
@AsjadMahmood you can use the following workaround:
|
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
lb4 service
command, to tie this datasource to a serviceAcceptance criteria
based on #3288 (comment)
lb4 service
andlb4 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:
lb4 repository
is already treating unknown connectors as compatible: https://github.com/strongloop/loopback-next/blob/b0a84b5adc30cac3614ea90e414b59cf76009ecf/packages/cli/generators/repository/index.js#L265-L276lb4 service
interprets "unknown" as "incompatible": https://github.com/strongloop/loopback-next/blob/b0a84b5adc30cac3614ea90e414b59cf76009ecf/packages/cli/generators/service/index.js#L191-L196lb4 service
toreturn result !== false
should fix the issue.remote-service.integration.js
, take a look at the test forlb4 repository
for inspiration here🎆 Hacktoberfest 2020
Greetings 👋 to all Hacktoberfest 2020 participants!
Here are few tips 👀 to make your start easier, see also #6456:
#loopback-contributors
channel, you can join our Slack workspace here.The text was updated successfully, but these errors were encountered: