Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`~` stringifies maps with Java Map.toString() instead of Python dict repr

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

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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend

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

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 HubSpot/jinjava

Tất cả issue của HubSpot/jinjava

Issue tương tự

Thêm issue về Java

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.