-
Notifications
You must be signed in to change notification settings - Fork 674
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
MF-906 - Change single creation endpoints to use bulk service calls #927
Conversation
Signed-off-by: Nick Neisen <nwneisen@gmail.com>
Signed-off-by: Nick Neisen <nwneisen@gmail.com>
Signed-off-by: Nick Neisen <nwneisen@gmail.com>
Signed-off-by: Nick Neisen <nwneisen@gmail.com>
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.
@nwneisen I would prefer to keep method naming simple and clean by removing Bulk
word :) So I would prefer Create() vs BulkCreate() etc... even if method accept a slice of things/channels
Word bulk adds complexity and confusion IMHO, keeps things simple as they are and documenting interface (good comments) is perfect.
I am approving PR, good job really! This is just my personal feeling about naming, which you can accept or not :) It's your call.
@nwneisen you have a message from the SemaphoreCI:
|
@nmarcetic I agree completely. When I do a search for remaining "bulk" word usages, I only see it still used with the single vs bulk endpoints. Let me know if there is somewhere I am missing. I will say that I am still in favor of depreciating this single endpoint as well. If only one thing/channel is needed, then a user would simply send an array of size one. This would make it so the user only needs to understand one method to create a thing/channel. |
@nwneisen exactly, this would be the best approach. |
@drasko Making sure everyone is on board as this was my previous suggestion.
The single endpoint will create a thing/channel when is passed an empty payload. It also returns the created thing's/channel's ID in the location header. |
I am interested what would the others say, but personally this looks OK for me - passing an empty call means "create one thing without metadata", while passing a call with array of length 1 in a parameter might mean "create one thing with this meatadata". I am however thinking that we might be interested in creating for example 100 things without metadata, and I do not know how we can do it with this API... @nmarcetic @anovakovic01 @dusanb94 ^ |
Signed-off-by: Nick Neisen <nwneisen@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #927 +/- ##
=========================================
- Coverage 83.85% 82.95% -0.9%
=========================================
Files 75 75
Lines 5667 5298 -369
=========================================
- Hits 4752 4395 -357
+ Misses 655 643 -12
Partials 260 260
Continue to review full report at Codecov.
|
@drasko Using bulk create, an empty JSON payload ( |
@nwneisen yep, I see. It looks OK to me, I think there is no particular need to complicate the code and add other options - especially that most of the time interaction with the REST API will be via CLI or SDK (meaning that CLI and SDK must be changed as well in this PR, if the API changes). Never the less, I'd like to hear the opinion of other maintainers. |
@drasko I don't think that we need an endpoint for the creation of a single thing. |
I agree with @anovakovic01 What do you think @nwneisen ? |
I agree with @nmarcetic. @nwneisen Please resolve remaining remark (variadic Save), so that we can approve and merge. |
@nmarcetic I was thinking leave the single endpoint for now but look at adding a depreciation warning and/or announcement for when it would be completely removed. |
Signed-off-by: Nick Neisen <nwneisen@gmail.com>
@nwneisen |
I was thinking leave the single creation endpoint (/things) for now* |
@nmarcetic @nwneisen can we open an issue for this merging of endpoints not to forget? |
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
@drasko @nmarcetic I will add the depreciation warning and place a warning in the docs before this PR gets merged |
Signed-off-by: Nick Neisen <nwneisen@gmail.com>
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!
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
Thanks @nwneisen, again a great contribution! I like PRs that remove code :). |
…927) * Change single endpoints to use bulk creation Signed-off-by: Nick Neisen <nwneisen@gmail.com> * Remove single creation from thing's service Signed-off-by: Nick Neisen <nwneisen@gmail.com> * Remove single save from thing's postgres Signed-off-by: Nick Neisen <nwneisen@gmail.com> * Change BulkSave to Save Signed-off-by: Nick Neisen <nwneisen@gmail.com> * Change service calls to use variadic parameters Signed-off-by: Nick Neisen <nwneisen@gmail.com> * Change postgres things to use variadic functions Signed-off-by: Nick Neisen <nwneisen@gmail.com> * Add depreciation warnings Signed-off-by: Nick Neisen <nwneisen@gmail.com>
What does this do?
Changes the single things and channels creation endpoints to use bulk service calls. All code for single creation is removed and tests updated to use bulk creation calls.
Which issue(s) does this PR fix/relate to?
Resolves #906
List any changes that modify/break current functionality
Single creation endpoints behave the same from a user's perspective.
Have you included tests for your changes?
Tests were updated to use bulk creation methods.
Did you document any new/modified functionality?
NA
Notes