[Bug]: json-xml-mediator policy turns XML text that looks like a number into a JSON number
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by locating the json-xml-mediator policy implementation and its XML-to-JSON conversion tests; the issue does not name specific files. Trace where XML text values are trimmed and inferred as numbers or booleans, then check how the policy documentation's Example 1 represents string values. Done means XML text such as 02134 and 1.10 reaches the client unchanged as JSON strings for both backend responses and XML requests.
由索引模型根据 Issue 内容生成。
描述
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
When the policy converts XML to JSON, it guesses a type for each text value. Text that parses as a number becomes a JSON number, and true and false become booleans. Surrounding whitespace is trimmed first.
XML text has no type, so the guess loses data. Leading zeros and trailing zeros disappear. A ZIP code 02134 becomes 2134, and a version 1.10 becomes 1.1. This applies to backend responses and to XML requests alike.
The policy documentation does not describe the guess. Its Example 1 shows an order ID kept as the string "12345".
Expected Behaviour
Text reaches the client unchanged, as a JSON string: {"order":{"version":"1.10","zip":"02134"}}.
Actual Behaviour
The client receives {"order":{"version":1.1,"zip":2134}}.
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"}} - Have the backend answer
application/xmlwith<order><zip>02134</zip><version>1.10</version></order>. - Send
{"sku":"W-1"}withContent-Type: application/json. The client receives{"order":{"version":1.1,"zip":2134}}.
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 scripted to answer the XML above
- 主要语言
- Go
- 星标
- 85
- 派生
- 142
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 255
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wso2/api-platform 的其他 Issue
-
Area/Policies Aspect/API Severity/Major Type/Bug
难度 2/5 1-3 小时 新手友好度 76/100
wso2/api-platform#4468 ·
维护者通常 1 天内回复
-
Area/Policies Aspect/API Severity/Major Type/Bug
难度 2/5 1-3 小时 新手友好度 68/100
wso2/api-platform#4465 ·
维护者通常 1 天内回复
-
[Bug]: Invalid [api_portal.http_client.tls] value reports an error naming server.https可能已有人在做 @Maheesh09 于 1 天前认领。 未关闭Area/DeveloperPortal Aspect/Configuration Severity/Minor Type/Bug
难度 2/5 1-3 小时 新手友好度 78/100
wso2/api-platform#4437 · 1 条评论 ·
维护者通常 1 天内回复
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
难度 1/5 1 小时以内 新手友好度 88/100
wso2/api-platform#4369 ·
维护者通常 1 天内回复
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy accepts未关闭Area/Policies Aspect/Other Severity/Trivial Type/Bug
难度 1/5 1 小时以内 新手友好度 91/100
wso2/api-platform#4355 ·
维护者通常 1 天内回复
查看 wso2/api-platform 的全部 Issue
相似的 Issue
-
[inputs.internal] README lists go_version tag on internal_gather instead of internal_agent可能已有人在做 @cvas22 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
influxdata/telegraf#20264 ·
维护者通常 1 天内回复
-
[Bug] Standalone migration breaks existing Ingress routes using the envoy-http Service port name未关闭accepted bug wg/enterprise-environment
难度 2/5 1-3 小时 新手友好度 78/100
vllm-project/semantic-router#7483 · 1 条评论 ·
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 64/100
stacklok/toolhive-catalog#2076 ·
维护者通常 1 天内回复
-
vulncheck or vulndb
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
gke-labs/kube-agents#7441 ·
维护者通常 1 天内回复