Added @IgnoreParameter meta annotation #3577
Open
+35
−1
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.
This is an attempt to add the custom parameter annotations ability requested #2890 in a way that is not intrusive to the existing Retrofit API surface.
I added an
@IgnoreParameter
meta annotation that can be applied to any custom parameter annotation that then causes Retrofit to ignore it during processing. The developer is then free to handle the annotation in a custom request interceptor if they so choose.This approach preserves the behavior of any existing non Retrofit managed parameters causing Retrofit to throw an exception when building the client.
Example Usage
The biggest downside to this method is that it requires just-in-time handling of any custom annotations in your interceptor which is not ideal but not worse than being unable to do it in the first place in my opinion.
I'm also not satisfied with the name.
@IgnoreParameter
seems a little clunky so I'm open to suggestions.