-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-Value Query Overrides #52
Comments
Good find and I agree that making the behavior of I am 95% satisfied with the plan to change the override map to use That said, if there is a tactic that avoids the construction of 1-entry Lists for each value and is not especially difficult to implement or constraining, I am interested in exploring that option. |
FWIW, treating them all as lists isn't any different from how HttpRequest handles it (which is where these values are being pulled from in a typical request). Still, just to throw an idea out there, you could manage two override maps, one with single string values, the other with multi-string values. The single string Note: For consistency with how HttpRequest#getParameter works, |
In the Query class, you can override values via the
Query#put
methods. However,Query#getStrings
and the other multi-value methods do not use the override map. They can't really, because the override field is aMap<String, String>
. This means that if you were to use a transformative validator, for exampleLowercase
, then the result ofQuery#getStrings
is unaffected. This is inconsistent with the behavior you'd expect from that validator as well as the result/behavior you'd get from callingQuery#get
instead.On the note of the override field, I think that it should instead be a
Map<String, List<String>
, so in the case of single-valued keys it would be a singleton list. Then add anotherQuery#put
method that accepts an array of strings (as well as ones accepting ints, longs, and booleans, though the only critical one is the array of strings).This could become tricky with regards to
InputTransformer
. But to keep it simple, it should just use getStrings every time, then have the transformation process be performed on each element in the list individually so that it can then set the override to the transformed list as a whole. This way it avoids the need to change any transformative validators. If someone wants to transform whole lists of values as a group, that's fine and they can still do that as a custom class, butInputTransformer
would simply be a class for transforming each matching value, not each collective set of values.See:
The text was updated successfully, but these errors were encountered: