Aias00 opened a new issue, #7736:
URL: https://github.com/apache/shenyu/issues/7736

   ### Current behavior
   
   `BodyParamUtils.buildParameters()` recognizes JSON name-to-type mappings. 
When the mapping contains exactly one nonprimitive type, it switches into the 
legacy whole-body single-argument path and passes the original mapping JSON 
string as `parameterTypes`.
   
   `buildSingleParameter()` then emits that entire JSON string as the Java type 
name and keeps the outer parameter-name wrapper in the argument value. The 
multi-parameter name-mapping branch instead uses resolved type names and mapped 
values.
   
   ### Location / reachable flow
   
   - 
[BodyParamUtils.java:81–93,103–132](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/utils/BodyParamUtils.java#L103)
   - `DubboParamResolveServiceImpl.buildParameter()` delegates here.
   - 
[ApacheDubboProxyService.java:104–112,123–128](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/proxy/ApacheDubboProxyService.java#L104)
 forwards the produced type/argument arrays to `GenericService.$invoke()` for 
normal non-Protobuf calls.
   
   ### Reproduction / validation
   
   Configure the supported manually supplied name-mapping metadata form:
   
   ```json
   {"arg":"java.util.Map"}
   ```
   
   Use body `{"arg":{"name":"Ada"}}`. A probe compiled the current 
BodyParamUtils and called its actual builder, producing:
   
   ```text
   MAPPED_TYPES=[{"arg":"java.util.Map"}] ARGS=[{arg={name=Ada}}]
   ```
   
   Expected type array: `[java.util.Map]`; expected argument: the map 
`{name=Ada}`. An independent reviewer traced the resolver and generic consumer. 
No live Dubbo provider was contacted; the invalid outbound type token and wrong 
argument shape are directly observed.
   
   ### Impact / suggested fix
   
   Exactly-one nonprimitive name-mapped calls fail generic type/method 
resolution or bind an incorrect object shape. Keep JSON name mapping on the 
resolved name/type/value path even when there is only one entry; reserve the 
whole-body behavior for legacy plain-type metadata. Preserve multi-parameter 
mapping and existing non-mapped single-bean compatibility.
   
   ### Related existing work
   
   #1306 introduced manually configured name/type mappings; #2090 concerns 
multi-parameter order/name binding without the single-entry branch; #4500 
concerns nested JSON conversion; #3394 concerns empty bodies losing parameter 
types. This is a non-empty one-entry JSON-mapping edge case, independently 
reproduced and not covered by those reports.
   
   
   ### Reviewed revision
   
   Apache ShenYu 2.7.2-SNAPSHOT, 
`master@66d7d954ca37d651a5ad916f988a8081157a7ab4`. Priority P2 / Medium. 
Unit-test and CI issue categories excluded.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to