Unable to create @Body
See original GitHub issueHello, I try to use Moshi with Retrofit, I used Yelp to generate calls and objects (https://github.com/Yelp/swagger-gradle-codegen)
I receive an error :
Unable to create @Body converter for class ObjectRequest (parameter #1)
@POST("/xxxxxxx")
fun call(@Body object: ObjectRequest): Single<ObjectResponse>
class ObjectRequest {
@Json(name = "field")
var field: String? = null
}
Retrofit.Builder()
.baseUrl("xxxxxxxxxxxxxx")
.addConverterFactory(MoshiConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(okHttpClient)
.build()
.create(xxxxxx::class.java)
val moshi = Moshi.Builder()
.add(XNullableAdapterFactory())
.add(KotlinJsonAdapterFactory())
.add(TypesAdapterFactory())
.build()
Retrofit.Builder()
.baseUrl("xxxxxxxxxxxxxx")
.addConverterFactory(MoshiConverterFactory.create(moshi))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(okHttpClient)
.build()
.create(xxxxxx::class.java)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
NX10 Unable to create body - Siemens: UG/NX - Eng-Tips
Trying to create a keyway using sketch 5 but whenever I select the face it says Unable to create body - change the...
Read more >Flat pattern, unable to create body - Siemens Communities
DaveK asked a question. I hate when it gives you the preview of exactly what you want, and then says "Unable to create...
Read more >Retrofit: Unable to create @Body converter for class
Solution: declare body value in your interface with next: @Body RequestBody body and wrap String JSON object:.
Read more >Unable to create a Flat Pattern of sheet metal body in Fusion ...
Unable to create a Flat Pattern of a sheet metal bend body in Fusion 360. Causes: The design has flanges that are overlapping...
Read more >Unable to create single body that is the sum of the input bodies!
25 votes, 16 comments. 51K subscribers in the SolidWorks community. ALL posts related to SOLIDWORKS are welcome. Share what you know.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes. Moshi does not serialize platform types by default. Change it to the interface
Listor register an adapter forArrayListwith Moshi.My bad, i have auto-formatted some classes with ArrayList instead of List, it works