Repository navigation
Convert elements of collection- and array-valued query method parameters - #3514
seonwooj0810 wants to merge 3 commits into
Conversation
…ers. Query method parameters exposed through Spring Data REST were passed to the backing repository without element conversion when the raw value already was an instance of the declared target type (e.g. a `List`). As a result, a repeated request parameter such as `?colors=RED&colors=GREEN` reached an `in`-style query as a `List<String>` instead of a `List<Color>`, causing the persistence provider to fail. `ReflectionRepositoryInvoker` now also invokes conversion for array- and `Iterable`-typed parameters even when the value already matches the target type, so the raw elements get converted to the declared element type. Signed-off-by: seonwoo_jung <79202163+seonwooj0810@users.noreply.github.com>
adb1c6d to
0ba14c1
Compare
|
Following up on this one — let me know if the approach needs rework or if anything's blocking a look. |
| Object value = unwrapSingleElement(rawParameters.get(parameterName)); | ||
|
|
||
| result[i] = targetType.isInstance(value) ? value : convert(value, param); | ||
| // Collection- and array-valued parameters must be converted even if the value already is an instance of |
There was a problem hiding this comment.
Please refrain from adding arbitrary comments into code introducing ticket references. These cause rather distraction and noise and we are not going to merge these changes in their current form.
Signed-off-by: seonwooj0810 <seonwooj0810@gmail.com>
|
Well, now it seems I am talking to AI. The problem with these kind of pull requests is that (while I appreciate usage of AI to bridge communications), that they are bloated. Do you seriously ask us to read walls of text? This is to some degree an concern regarding respect towards maintainers. Besides all else,
Is just noise and requires effort from our time where it contains actually something useful or whether it restates what the diff already shows. Such pull requests are annoying an if this wouldn't had a bug characteristic, its negative value wants me to immediately it. Going forward, please make sure you thoroughly reviewed both, code changes and the description. We have 100's of similar looking pull requests, all full of text resulting on a DDoS on our time and willingness to accept contributions. |
Signed-off-by: seonwoo_jung <79202163+seonwooj0810@users.noreply.github.com>
|
Fair point. I cut the description down to the actual change and removed the leftover ticket comment from the test in d6d788c. I'll keep future PRs short. |
Fixes #3502
prepareParametersskipped conversion when the value was already an instance of the parameter type, so aList<String>bound to aCollection<Color>parameter never had its elements converted. Array andIterableparameters are now always passed through conversion.