-
Notifications
You must be signed in to change notification settings - Fork 362
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
Make this lib peerDepend on loopback-connector #1326
Make this lib peerDepend on loopback-connector #1326
Conversation
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
Can one of the admins verify this patch? |
2 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
00a02b6
to
09a76f5
Compare
@bobbysmith007 Please sign the CLA before I can proceed with the PR: https://cla.strongloop.com/agreements/strongloop/loopback-datasource-juggler |
@slnode test please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@slnode test please |
@bobbysmith007 Are you aware of the complication around peerDependencies - https://docs.npmjs.com/files/package.json#peerdependencies? |
raymondfeng: I read that page before deciding that they were the correct path to go. (Initially I had only wanted to list them in devDependencies) Its definitely wrong / buggy to try and share object models between the three libraries (relying on instanceof) without them all sharing the same exact references. Peer dependencies looks to be trying to solve this exact problem (pluggable modules that share object models). Also it seems that it should be the applications responsibility to depend on loopback-connector-dbbackend and loopback and it is loopbacks job to depend on loopback-connector and loopback-datasource-juggler, which I think leaves us in a situation where all the libraries will be installed at once without experiencing the warning about libraries being required but not installed. Additionally, the remedy to the warning is simply to add that package to your application (or loopbacks) dependency chain. I will admit that this is the first time I have interacted with peerDependencies, and I was searching to the solution for this issue of needing to be siblings accessing the same libraries. I have no practical experience with whether this path is fraught with future heartache. |
@slnode test please |
09a76f5
to
46dcb06
Compare
@raymondfeng Any objection on using |
@slnode test please |
46dcb06
to
90fa24d
Compare
@ssh24 I don't have strong objections to |
@raymondfeng I believe it throws an error when the peer dependencies are not satisfied. That is why I had to update a few downstream dependency connectors to use the latest |
@slnode test please |
Please read also strongloop/loopback#275, |
This issue seems to be a recapitulation of strongloop/loopback#275. That issue was because folks had their own private I don't know what the right or wrong answer here is (because managing complex dependencies is hard), but shared object models really aught to be shared or we cannot ever use the type information effectively (because To me (with much less experience in node than all of you) it seems that all loopback related modules should be loaded at once - in one dependency depth. That seems to be the point of peerDependencies - we are all sharing one shared object model. The top level loopback or loopback application should be responsible for listing all related modules that need to be loaded into one dependency space. |
@bobbysmith007 thank you for chiming in!
I our experience so far, there is no reliable way to ensure that after Yes, it means we cannot rely on
Let me show you an example why this is not possible.
As an application developer who wants to use both Now in most cases, the app developer won't be aware of this problem and they will happily happily install the latest versions of all dependencies (
Obviously, the code relying on Let's consider LoopBack maintainers too: to make a breaking change in loopback-connector, we would have to update all connectors (including the community-maintained ones) immediately after a new semver-major version of loopback-connector was released. That would cause breaking changes to be very expensive and even more difficult to get through. |
* create sequence for nosql id (#1354) (Janny) * Fix order of query results (Loay) * Add DateString type (Kevin Delisle) * datatype.test: use predefined date (Kevin Delisle) * Update api documents (Loay) * Datasource documentation tune-up (Kevin Delisle) * Added unit tests specific to DateType where null (#1349) (Andrew McDonnell) * Fix/geo null (#1334) (paulussup) * replace exception thrown for invalid dates (Diana Lau) * Revert PR #1326 (#1336) (Sakib Hasan) * Make lib peerDepend on loopback-connector (#1326) (Russ Tyndall) * Add test case using updateAttributes (Loay) * Fix forceId bug for updateOrCreate (Loay) * Fix typo in description (jannyHou) * Fix relations test case (loay)
Description
helping orchestrate this (eg: loopback-connector,
loopback-connector-postgresql)
loopback-connector.ParameterizedSQL object
see: AccelerationNet/loopback-connector-postgresql@0661c6c
Tests
I was unsure how to add tests for this as the bug is only apparent in a full working loopback, but there are possible bugs because the loopback-connector-postgresql creates ParameterizedSQL objects that
are incompatible with the ones here because both list loopback-connector as a dependency rather than a peerDependency. If we are sharing object models, they all need to come from one instance of the library rather than from separate ones
Related issues
Checklist
guide