konlue opened a new pull request, #7746:
URL: https://github.com/apache/shenyu/pull/7746

   Fixes #7736.
   
   ## Summary
   
   `BodyParamUtils#buildParameters` takes the legacy whole-body single-argument 
path whenever the resolved type list has exactly one non-base entry — including 
a single-entry JSON name mapping. `buildSingleParameter` then uses the original 
mapping JSON as the parameter type and keeps the outer parameter-name wrapper 
in the value, so generic type resolution fails or binds the wrong shape.
   
   ## Modifications
   
   - Restrict the whole-body shortcut to non-mapped metadata 
(`!isNameMapping(parameterTypes)`); name-mapped parameters always use the 
resolved name/type/value path, regardless of entry count.
   - Add `BodyParamUtilsTest` covering: single-entry mapping → 
`["java.util.Map"]` / bare map argument; multi-entry mapping ordering; plain 
single bean keeps whole-body semantics; single mapped base type unchanged.
   
   ## Verifying this change
   
   - [x] Red-green: with the original shortcut restored, 
`testSingleNameMappedParameterUsesResolvedTypeAndValue` fails (the type is the 
mapping JSON and the argument keeps the `arg` wrapper); with the fix all four 
tests pass.
   - [x] Targeted tests pass:
   
     ```bash
     ./mvnw -B -ntp -pl shenyu-plugin/shenyu-plugin-api test 
-Dtest=BodyParamUtilsTest
     ```
     4/4 green.
   
   - [x] Checkstyle passes:
   
     ```bash
     ./mvnw -B -ntp -pl shenyu-plugin/shenyu-plugin-api checkstyle:check
     ```
     clean.
   
   ## Notes
   
   `buildSingleParameter` itself is unchanged, so any direct caller keeps its 
behaviour; only the name-mapping branch inside `buildParameters` changes. 
Multi-parameter mappings and non-mapped plain-type calls are untouched.


-- 
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