[Bug]: json-xml-mediator policy writes large and small JSON numbers in exponent form
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
- 68/100
Hướng nghiên cứu
Bắt đầu bằng cách tìm mã của policy json-xml-mediator định dạng các số JSON bằng động từ %g của Go; issue xác định policy và hành vi bị ảnh hưởng nhưng không nêu tệp hay bài kiểm thử nào. Kiểm tra cách các bài kiểm thử policy hiện có bao quát việc chuyển đổi JSON sang XML, sau đó thêm các trường hợp cho 1234567 và 0.00001. Công việc hoàn tất khi các phần tử XML đó giữ nguyên giá trị thập phân thay vì dùng ký pháp số mũ và các bài kiểm thử liên quan đều đạt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Please select the area the issue is related to
Gateway
Please select the aspect the issue is related to
Aspect/API (API backends, definitions, contracts, interfaces, OpenAPI)
Description
The json-xml-mediator policy converts a JSON request to XML for the backend. It formats every JSON number with Go's %g verb.
%g switches to exponent form for numbers of a million or more and for numbers below 0.0001. So 1234567 reaches the backend as 1.234567e+06, and 0.00001 as 1e-05. An XML backend that expects decimal digits rejects or misreads these values.
Numbers between 0.0001 and a million are not affected. The policy doc says the policy converts all JSON data types.
Expected Behaviour
The XML element holds the number as the JSON wrote it, such as 1234567 and 0.00001.
Actual Behaviour
The backend receives <root><population>1.234567e+06</population><ratio>1e-05</ratio></root>.
Steps to Reproduce
- Create a REST API with the policy on a POST operation:
{"name":"json-xml-mediator","version":"v1","params":{"downsteamPayloadFormat":"json","upstreamPayloadFormat":"xml"}} - Send
{"population":12345,"ratio":0.5}withContent-Type: application/json. The backend receives<root><population>12345</population><ratio>0.5</ratio></root>. - Send
{"population":1234567,"ratio":0.00001}. The backend receives<root><population>1.234567e+06</population><ratio>1e-05</ratio></root>.
Severity Level of the Issue
Severity/Major (Important functionality is broken. Should be prioritized. Doesn't need immediate attention)
Environment Details (with versions)
- Gateway versions: 1.1.0, 1.2.0 and latest
- Policy:
json-xml-mediatorv1.1.0, wso2/gateway-controllers main5b8e3367 - Upstream: a test service that records the request body
- Ngôn ngữ chính
- Go
- Star
- 85
- Fork
- 142
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 250
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không 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 wso2/api-platform
-
Area/Policies Aspect/API Severity/Major Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
wso2/api-platform#4468 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Invalid [api_portal.http_client.tls] value reports an error naming server.httpsCó thể đã có người làm @Maheesh09 đã nhận 1 ngày trước. Đang mởArea/DeveloperPortal Aspect/Configuration Severity/Minor Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
wso2/api-platform#4437 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
wso2/api-platform#4369 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy acceptsĐang mởArea/Policies Aspect/Other Severity/Trivial Type/Bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
wso2/api-platform#4355 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: A refused request's analytics event and traffic log lose the path the client calledCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởArea/Gateway Aspect/API Severity/Minor Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
wso2/api-platform#4348 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của wso2/api-platform
Issue tương tự
-
Area/Agent Lifecycle Aspect/Build & Deploy Severity/Major Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
wso2/agent-manager#2603 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Enhancement] platform-engineer: a definition change does not re-render running Applications; say how to roll it outCó thể đã có người làm @anoop2811 đã nhận hôm nay. Đang mởneeds-triage type/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
review: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
1lck/Lithe-IDEA#2432 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
dsx-ai-factory/health-validation#368 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
keyxmakerx/Chronicle#2824 ·
Maintainer thường phản hồi trong vòng 1 ngày