-
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
Driver Interface #776
Comments
I used Sails before Loopback, and had to change Waterline for Sequilize (not without pain). |
We do intend to have a Juggler in v4 as per the discussion in #537, though we will be simplifying it somewhat to reduce friction between datasources and make it easier to support more widely. @Untel It's not necessarily a production-ready mixin per se, but it does demonstrate how you can still leverage LoopBack 4's Application, Context and Controller patterns with a totally different ORM. |
@jpventura thank you for opening this issue.
I took a look at your tutorial application. As far as I understand, it's a typical LoopBack 3.x application. It makes we wonder, how did you reach the conclusion that "it is not possible to automagically consume the API because the server might not provide all CRUD functionalities required by First of all, Are you perhaps referring to the REST API layer? This is something we have to figure out yet. I am personally proposing the approach where controller methods are generated by our CLI tooling, as I have explained in great length in my comment #485 (comment) about migration from LB 3.x to 4.x. There is also a pull request in review that creates a controller base class providing a common CRUD REST endpoints - see #740. Setting aside the fact that I don't understand what is the problem you are facing and how Waterline is going to solve that, I'd like to second what @kjdelisle said in the comment above - we have specifically designed LoopBack 4 to allow developers to use a different ORM instead of our juggler. Of course, you would have to write your CRUD controller methods yourself.
Our controllers do have a standard driver interface, even if it's not as well documented as Waterline's. See the following two pages for more information:
We have APIs for inspecting database schemas in juggler (is that what you meant?), there is even a basic templated implementation for SQL connectors - see the code in SqlConnector. I feel I may be missing the point you are trying to make, could you please elaborate more on what issues do you see and what real-world scenarios you are not able to accomplish right now? |
Looks like this proposal does not have enough traction, I am closing this issue for now. |
Description/Steps to reproduce
I've started using LoopBack because the connectors and datasources seemed like a canned solution for fast integration with RESTful APIs with API Blueprints or Swagger specifications.
However, while I was trying to create a simple tutorial app, I discovered that it is not possible to automagically consume the API because the server might not provide all CRUD functionalities required by
PersistentModel
.Even if Pet Store or TMDB were written in Swagger, the auto import would not be possible.
Driver Interface
Waterline adapters are similar to connectors, except for the fact they define a standard driver interface should provide:
As mentioned at #537, queries would be written in Knex.js language to provide queries.
Expected result
Providing standard methods similar to the driver interface would help juggler to inspect datasources, allowing we faster abstract any kind of local/remote data access.
Also it would be possible to provide an elegant query language:
The text was updated successfully, but these errors were encountered: