[REQ] Kotlin Spring Server Generator: adopt the pattern used by Java Spring Server generator
Created by: mikezx6r
Currently, the Kotlin Spring Server generator produces a Controller that calls a 'delegate' service. The controller code assumes that the delegate service will either return successfully, OR throw an exception.
This means no custom validation of input or pre-processing can be performed in the Controller class, AND that the service MUST use exception handling for all error situations.
The Java Spring server generator creates a Controller interface that has an _
prefixed method for the RequestMapping and parameter annotations and then calls a method that has a default implementation. This method makes no assumptions about the result as it returns a ResponseEntity.
The server code then inherits the interface, and overrides the method. This allows the Controller to do request data validation and formatting as well as not be forced to use Exceptions for error handling.
@dr4ke616 Would you be open to an update to the Kotlin spring Server generator that utilizes this pattern rather than the existing one?
It obviously would be a breaking change for anyone using the generator now.
If not, then I'll have to decide if I submit a new one, or merely create a custom one, or continue using the Java one. Don't like the latter option as it means I don't get the benefit of nullability being properly generated in model objects and Controller functions.