OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.61k stars 6.29k forks source link

Change return types for Spring openapi-generator-maven-plugin generated interfaces #6135

Open fearlessfara opened 4 years ago

fearlessfara commented 4 years ago

I've managed to generate the interfaces from a .yaml open-api descriptor file, but, as in the question title, I'd love to change the response type of those interfaces from ResponseEntity to my own types. Basically instead of the interface having this signature: ResponseEntity<Void> clearCache(); for a method that is implemented basically this way: public void clearCache(){ //do something} I'd want the generated interface to be as simply as void clearCache(); Same thing for my own defined classes, instead of ResponseEntity<MyBook> getBook(String ISBN); I want it to just use MyBook as return type, so it should look something like MyBook getBook(String ISBN);

I think this could be a really useful feature for the future of this openapi-generator plugin, currently I haven't managed to get it do what I'm looking for but I think here on the community with this issue (which was suggested me to create it by @wing328 ) I'll find a solution to it!

MaksimMyshkin commented 1 year ago

As I see this feature is released in 6.5.0 with useResponseEntity flag for spring generator. It's still missing for kotlin-spring generator (don't know if I should create a new issue).

alex-semenk commented 6 months ago

+ 1 It would be nice to have useResponseEntity flag for kotlin-spring generator as well.

rhengeveld commented 3 weeks ago

+1 working on my first Kotlin project, I'm surprised to find kotlin-spring does not support this flag.

I might switch to the spring generator as I don't like to "pollute" my code with ResponseEntity.