Skip to content

Commit

Permalink
Add ability to use scalars as Retrofit responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel Szymanski committed Oct 12, 2018
1 parent 0cc5f17 commit 0e628b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ dependencies {
implementation 'com.android.support:support-annotations:25.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.4.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
api 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.google.dagger:dagger:2.7'
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/creatubbles/api/ServiceGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.converter.jackson.JacksonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;

/**
* Created by Janek on 08.02.2016.
Expand Down Expand Up @@ -111,6 +112,7 @@ public void initialize() {
resourceConverter.enableDeserializationOption(DeserializationFeature.IGNORE_UNREGISTERED_TYPES);
JSONAPIConverterFactory converterFactory = new JSONAPIConverterFactory(resourceConverter);
converterFactory.setAlternativeFactory(JacksonConverterFactory.create(objectMapper));
builder.addConverterFactory(ScalarsConverterFactory.create());
builder.addConverterFactory(converterFactory);

}
Expand Down

0 comments on commit 0e628b4

Please sign in to comment.