medly / apifi

Open API spec driven HTTP APIs
https://jitpack.io/#com.medly/apifi
4 stars 5 forks source link

Responses without body/content does not work #31

Open ashwini-desai opened 4 years ago

ashwini-desai commented 4 years ago

Problem: Certain HTTP status do not have a response body like 201(response body optional) and 204. But currently, specific yml without response content results in codegen failure.

Tech Details:

  1. Fails in ResponseBodyParser.kt where we do r.value.content?.values!!. values in not present for contents without body.

Expected Behaviour:

  1. Response body should be made optional.
  2. Controller 's method should also not have any return type (this could be tricky)
AniketSK commented 4 years ago

I'd like to take a look at this. Could you elaborate on point 2?

ashwini-desai commented 4 years ago

Hey @AniketSK ,

Controller's response today is set to HttpResponse where T is picked with some logic. This will have to be changed for the status which do not have response body. It might be tricky based on how open api parser returns the responses.

Looking at code bit more would help understand what I mean above.