[BUG] create helper function ignores the id property when it's equal to 0.
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
- Lĩnh vực
- databases
Hướng nghiên cứu
Bắt đầu tại hàm createCallback trong dao.js, khoảng dòng 378, và theo dõi cách callback id được gán cho đối tượng được tạo. Tái hiện một lệnh gọi create với id bằng 0, sau đó bổ sung coverage cho phản hồi dự kiến và xác minh rằng các id từ 0 trở lên được giữ nguyên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description :
Create call on a loopback model returns a property id as a response, in case where the property id starts from 0 it is removed from response. This is because the create function( dao.js line no 378) which gets the id as a callback on the create call in a loopback model, does not accepts 0 as an id.
Code snippet from dao.js
if id is 0 it is skipping the if block
function createCallback(err, id, rev) {
if (id) {
obj.__data[_idName] = id;
defineReadonlyProp(obj, _idName, id);
}
We have a scenario where the id starts from 0, and this is causing the id property for our 0th element to be removed from the response.
Steps to reproduce :
- Model which has a property id which starts from 0.
- Call the api to create which will have the id (starting from 0) in response.
- Response will be missing the id property for the first call where id is 0, and it'll add the id property in response starting from id as 1 onwards.
Current Response Behaviour :
id is removed when its value is equal to 0
{
"property1" : "property1",
"property2" : "property2"
}
Expected Results :
{
"id" : 0
"property1" : "property1",
"property2" : "property2"
}
- Ngôn ngữ chính
- JavaScript
- Star
- 279
- Fork
- 362
- Merge trung bình
- 21 giờ 14 phút
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của loopbackio/loopback-datasource-juggler
-
Breaking changes for `loopback-datasource-juggler@7` not listed anywhereCó thể làm lại được @dhmlau đã nhận 158 ngày trước và không có pull request nào đang mở. Đang mởbug
loopbackio/loopback-datasource-juggler#2548 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Replace deprecated util._extend with Object.assign to ensure compatibility with modern Node.jsĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
loopbackio/loopback-datasource-juggler#2530 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
allow empty array in createAllCó thể đã có người làm @ajay-prajapati07 đã nhận 533 ngày trước. Đang mởfeature
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
loopbackio/loopback-datasource-juggler#2409 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
loopbackio/loopback-datasource-juggler#2319 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Dependency DashboardĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
loopbackio/loopback-datasource-juggler#1917 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của loopbackio/loopback-datasource-juggler
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
anothaDev/luci-theme-vantage#143 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
kingcharleslzy-ai/dsh-purge#282 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
a-corriger bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
christian-raj/S-Aloha#340 ·
-
area:image documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày