Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2526
Closed
Open
Issue created Mar 27, 2019 by Administrator@rootContributor

[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.

Assignee
Assign to
Time tracking