empty string is converted to empty object in LoopBack3

Đang mở
#560 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, mysql, node.js
Lĩnh vực
database

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện hành vi với LoopBack 3.28.0, loopback-connector-mysql 7.0.5 và model có id string nullable được mô tả ở đây. Theo dõi đường đi của MySQL connector được sử dụng khi đọc thuộc tính đó; hoàn thành khi một chuỗi rỗng vẫn là một chuỗi rỗng, còn null và các chuỗi không rỗng vẫn giữ nguyên hành vi hiện tại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Steps to reproduce

LookBack version: 3.28.0
loopback-connector-mysql version: 7.0.5

This bug occurred after we upgraded the version of loopback-connector-mysql from 4.1.0 to 7.0.5.

define a nullable property in lb3 model like this:

"properties": {
    "id": {
      "type": "string",
      "required": false,
      "length": 255,
      "precision": null,
      "scale": null,
      "default":null,
      "mysql": {
        "columnName": "id",
        "dataType": "VARCHAR",
        "dataLength": 255,
        "dataPrecision": null,
        "dataScale": null,
        "nullable": "Y"
      }
    }
}

And then simply get this model from lb.

Bbserved Result

If id is an empty string, it will be converted to empty object. If id is null or non-empty string, it will be returned directly.

Expected Behavior

Empty string shouldn't be converted to empty object, and should be returned directly as null or non-empty string.

Additional information

node -e 'console.log(process.platform, process.arch, process.versions.node)'

darwin arm64 20.9.0

npm ls --prod --depth 0 | grep loopback

npm WARN config production Use --omit=dev instead.
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]

Ngôn ngữ chính
JavaScript
Star
126
Fork
181
Merge trung bình
3 ngày 22 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của loopbackio/loopback-connector-mysql

Tất cả issue của loopbackio/loopback-connector-mysql

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.