Repository navigation
Apply @Param expanders on QueryMap POJO fields and getters - #3658
Open
havefunatcode wants to merge 1 commit into
Open
havefunatcode wants to merge 1 commit into
havefunatcode wants to merge 1 commit into
Conversation
FieldQueryMapEncoder and BeanQueryMapEncoder now apply the @PARAM expander, per element for an Iterable. A @PARAM without a value falls back to the field or property name. @HeaderMap POJOs go through the same encoders, so their expanders apply too. Fixes OpenFeign#1312
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FieldQueryMapEncoderandBeanQueryMapEncoderonly used@Paramon a@QueryMapPOJO for the name, soexpanderwas ignored:Both encoders now create the expander once per class, next to the existing metadata cache, and apply it in
encode. It's instantiated withnewInstance()like method params are, and a failure throwsEncodeException. AnIterableis expanded per element (nullelements staynull), anything else (arrays too) goes to the expander as a whole, same as a method@Param. If the expander returnsnullthe entry is dropped like anullfield.Also fixed
@Param(expander = Foo.class)with no value, which sent the param with an empty name. It falls back to the field/property name now.@HeaderMapPOJOs use the same encoder, so header fields get their expanders too. Header POJOs without an expander are unchanged. Happy to limit it to query maps if you'd prefer.Added
defaultEncoder_withParamExpanderto both encoder tests (they fail on master) andmvn -pl core testpasses. README and CHANGELOG updated.Fixes #1312