Skip to content
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

From which version does Retrofit to allow annotations which are not part of the Retrofit api? #1828

Closed
VictorAlbertos opened this issue Jun 1, 2016 · 1 comment

Comments

@VictorAlbertos
Copy link

Hi

I remember that almost 1 year ago Retrofit threw an exception when an annotation outside of Retrofit api was used to annotate a method param. But now it doesn’t, it just ignore them.

I would like to know in which version this change was performed, if it that’s possible. Because I checked the CHANGELOG file and I didn’t find any information about this.

Nevertheless, I think this is really cool. Because it allows other libraries to play together with the same interface. Which I’m trying to do in order to create some sort of automated mocking and testing system.

Thanks!

@JakeWharton
Copy link
Collaborator

This change was made for 2.0 which changed a lot of old behaviors. It's not strictly called out in the change logs because it's not really a useful change on its own.

In fact, annotations on parameters are now passed to the converters. So, for example, you could have @Query("since") @Iso8601 Date since as a parameter and then register a converter factory with the Retrofit.Builder whose string converter could then see that Date type and see the @Iso8601 annotation and format the string appropriately. This is also true of the converter used for request bodies which are used for @Body and @Part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants