[WIP]Expose replace methods for related models - #3959
Conversation
|
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
|
@ivanschwarz thank you for the pull request and sorry for the long delay on our side. I took a quick glance at the proposed changes and they look pretty good to me 👍
I am afraid I disagree here. Here is a scenario to consider: a LoopBack user is running an application in production, their package.json is saying Your patch already contain the core of the solution to this problem - the feature flag To move this patch forward, we need that feature flag to be disabled by default for relational methods, in order to preserve backwards compatibility. I do realize What we can (and probably should) do is to modify the template used by
When bringing in latest changes from |
|
@bajtos : Thank you for the feedback. Let's say we keep the
It's also possible that I didn't understand your suggestions completely and you meant to solve it in a different way. I'm pretty new to LoopBack codebase, so I might be missing something. I can definitely make the update to the template used by My apologies for the merging from |
Ouch! I did not consider this scenario. You are right about the breaking change my suggestion would introduce. In that case, I am afraid we have to introduce a new feature flag. I have troubles coming up with a good name though. What do you think about changing the type of |
|
@ivanschwarz After LoopBack 4.0 GA was announced last week (the announcement), this repository has moved to Active LTS mode and no longer accepts new features. As a result, we can no longer accept this contribution 😞 Thank you for the understanding. |
|
@bajtos : Damn, I should've kept track of LoopBack 4 better. Well, all information was available, so it's my fault, that I was not able to finish in time. I was struggling to finish implementation of some of the relationships in loopbackio/loopback-datasource-juggler#1616, because they were implemented in another way, which delayed the whole process. I guess we can close that PR too. |
|
We are still using loopback-datasource-juggler in LoopBack 4. There are only two breaking changes between juggler@3 used by LB3 and juggler@4 used by LB4: Node.js 8.x or newer is required and we use native Promises instead of Bluebird. The goal was to allow us to start using async functions and await statements. I think it still makes sense to continue working on loopbackio/loopback-datasource-juggler#1616 and get it landed. The new API will be available to LB4 users. We are not going to back-port your pull request to v3 version of juggler, but if you are ok with running on Node.js 8+ and don't require Bluebird APIs, then you can fork v3 of Obviously, you will have to maintain your fork of loopback until you upgrade to LB4. I think it should be reasonably easy to keep the fork up to date with the upstream repository, because there are not that many changes happening in |
Description
This PR aims to implement the missing Full replace vs. partial update v3 change for related models. This is a breaking change, but I would argue, that it was already announced in the original v3 release notes, just not implemented. I've tried to be as much consistent as possible with the original implementation (#2316). I've implemented the changes just for the
hasManyrelation. As soon as I'm assured, that I'm on the right path, I can add it for other relations too.This PR depends on loopbackio/loopback-datasource-juggler#1616.
@bajtos : Can you review?
Related issues
Checklist
guide