papsign / Ktor-OpenAPI-Generator

Ktor OpenAPI/Swagger 3 Generator
Apache License 2.0
241 stars 42 forks source link

incorrect 'throws' rendering #45

Closed y9san9 closed 4 years ago

y9san9 commented 4 years ago

throws(APIException.apiException<ApiError, String>(HttpStatusCode.BadRequest, ""), fn = fn) This code have that result for me image

y9san9 commented 4 years ago

I have tried same with KotlinNullPointerException but not with my custom one. The result is same, logs here image

Wicpar commented 4 years ago

can you try the new syntax ? https://github.com/papsign/Ktor-OpenAPI-Generator/wiki/A-few-examples#exceptions-and-multiple-responses

Wicpar commented 4 years ago

Also, swagger-ui does not cover the full OpenAPI spec, i need to see the openapi.json for that request to verify what is going wrong.

Wicpar commented 4 years ago

Another issue could be that your gradle cache has an older version of snapshot, try to upgrade to a release version

y9san9 commented 4 years ago

I have found the reason. There was another throws {} block in upper level. If sumplify throws(...){ throws(...){} } I expected to catch exceptions by upper block for all requests, then jsonify and respond with it, but show error specifications for api in lover block for every single request UPD: Just now have same error by using vararg APIException

Wicpar commented 4 years ago

can you provide a code sample ?

y9san9 commented 4 years ago

Sure, I've replaced custom errors with null pointer throws( apiException<KotlinNullPointerException, String>(HttpStatusCode.BadRequest, "test"), apiException<KotlinNullPointerException, String>(HttpStatusCode.BadRequest, "test"), fn = fn )

y9san9 commented 4 years ago

That's it image

y9san9 commented 4 years ago

You should use another json code (and also I think that required ability to change example names) image

Wicpar commented 4 years ago

Ah i see, i'll look into it.

Wicpar commented 4 years ago

fixed in 0.2-beta.4 For more accurate names and descriptions there is no quick fix, this whole part needs a rework... #48