-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Milestone
Description
Description
API calls that have no response content causes a null pointer in retrofit.
Null is not a valid element
This is currently what is produced:
@POST("logout")
Observable<Void> logout();
This causes the: Observable onNext to never be called
Swagger-codegen version
2.2.3
Swagger declaration file content or url
/logout:
post:
operationId: logout
responses:
200:
description: success
401:
description: 401
Command line used for generation
{
"library": "retrofit2",
"groupId": "com.test",
"artifactVersion":"0.0.2",
"invokerPackage": "com.test",
"modelPackage": "com.test.model",
"apiPackage": "com.test.api",
"useRxJava2": true,
"hideGenerationTimestamp": true
}
swagger-codegen generate -i doc/api/definitions/test.yaml -c doc/api/config/test.json -l java -o libs/api/test
Using:
Kotlin, Java, Retrofit2
Steps to reproduce
- generate the api
- subscribe to api.logout()
Related issues/PRs
Suggest a fix/enhancement
Swagger-codgen produces Observable<Void>
when it should produce Observable<Response<Void>>
I found the solution here: https://stackoverflow.com/questions/41914037/rxjava2-retrofit2-handling-null-for-204-put-and-delete-requests
lawloretienne