Thrifty Retrofit converter
A Retrofit converter
implementation using Thrifty for (de)serialization of Apache Thrift requests and responses.
It supports Binary
, Compact
and Json
Thrift protocols. It supports Thrifty models generated in both Java
and Kotlin
.
Usage
Add the library as a dependency to your build.gradle
to automatically download it from Maven Central.
implementation "com.infinum:retrofit-converter-thrifty:3.0.0"
... and add the converter factory when you create the Retrofit
object.
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://example.com/api/")
.addConverterFactory(ThriftyConverterFactory.create(ProtocolType.COMPACT))
.build();
We also maintain a changelog.
Contributing
Feedback and code contributions are very much welcome. Just make a pull request with a short description of your changes. By making contributions to this project you give permission for your code to be used under the same license.
Generating new files with the thrifty compiler
In case source files need to be generated from .thrift files using a different version of the thrifty compiler, use these commands:
wget https://repo1.maven.org/maven2/com/microsoft/thrifty/thrifty-compiler/2.1.2/thrifty-compiler-2.1.2-all.jar
java -jar thrifty-compiler-2.1.2-all.jar --out=retrofit-converter-thrifty/src/test/java/ --lang=java retrofit-converter-thrifty/src/test/resources/phone.thrift
java -jar thrifty-compiler-2.1.2-all.jar --out=retrofit-converter-thrifty/src/test/kotlin/ --lang=kotlin --kt-file-per-type retrofit-converter-thrifty/src/test/resources/phone.thrift
Deploying a new version
To publish to Maven Central you first need to set the following Gradle properties:
signing.keyId=<GPG_KEY_ID>
signing.password=<GPG_KEY_PASSWORD>
signing.secretKeyRingFile=<GPG_SECRING_LOCATION>
sonatypeUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/
sonatypeUsername=<SONATYPE_USERNAME>
sonatypePassword=<SONATYPE_PASSWORD>
To deploy a new version to Maven Central, use deploy.sh
:
./publish.sh <artifact version> [optional tag message]
The publish.sh
script will automatically push a tag with the version name and change the version in the README.
All you need to do after the script runs is to press release in Sonatype OSS.