`~` stringifies maps with Java Map.toString() instead of Python dict repr
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
- 82/100
Hướng nghiên cứu
Start with src/main/java/com/hubspot/jinjava/el/ext/StringConcatOperator.java and trace the converter.convert calls used for concatenation. Reproduce the map case from the issue, then check the existing direct map and list rendering behavior. Done means ~ renders maps with the Python-style representation while the documented direct and list outputs remain unchanged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
~ converts each operand with JUEL's string converter, which falls back to Object.toString() for maps. A Jinjava map renders as {g=v}; Jinja2 renders the Python dict repr {'g': 'v'}.
Affected: master df50b0d7. Releases 2.7.6, 2.8.3 and 2.8.4 behave the same.
Reproduction
{{ {'g':'v'} ~ length }}
Jinja2 renders {'g': 'v'}. Jinjava renders {g=v}.
Direct output agrees between the engines: {{ {'g':'v'} }} renders {'g': 'v'} in both. A list operand also agrees ([1, 2]), so the difference is specific to map stringification through the concat path.
Root cause
StringConcatOperator.apply converts both operands with converter.convert(o, String.class) (src/main/java/com/hubspot/jinjava/el/ext/StringConcatOperator.java). The converter has no Python-style representation for maps, so the map's toString() value is used.
- Ngôn ngữ chính
- Java
- Star
- 787
- Fork
- 184
- Merge trung bình
- 6 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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 HubSpot/jinjava
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
-
Jinjava 3.0Có thể làm lại được @jasmith-hs đã nhận 210 ngày trước và không có pull request nào đang mở. Đang mở
-
Upgrade to Jackson 3.0.0Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của HubSpot/jinjava
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
apache/arrow-java#1311 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
IBM/networking-java-sdk#204 ·
-
bug Technical Debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
avniproject/avni-server#1080 ·