papsign / Ktor-OpenAPI-Generator

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

different body types #44

Closed y9san9 closed 4 years ago

y9san9 commented 4 years ago

Can I use different body types on success and on error? Because in Retrofit Im using different bodies with different types

Wicpar commented 4 years ago

Sending different response types should work if you use exception handlers, if they are on the same error code it should generate a oneOf definition. If you mean receiving different body types, then you might want to define an object that has a nullable parameters for the one or the other. Tell me if it doesn't work and i'll look into it.

y9san9 commented 4 years ago

Thanks that works pretty well. This library is rly nice, do not stop it's support :) And you should also write about this feature in wiki or README, cuz I'm exporing library from issues and I think there are so many unknown for users features

Wicpar commented 4 years ago

i added an example page in the wiki https://github.com/papsign/Ktor-OpenAPI-Generator/wiki/A-few-examples