OpenAPITools / OpenAPITools/openapi-generator

[kotlin-server] add support for delegate pattern

Open
#20,060 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

The current Kotlin Javalin generator creates a handler that directly calls a service, expecting the service to either return successfully or throw an exception. This approach prevents the handler from performing custom input validation or pre-processing, or handling multiple 2xx status code e.g 200 or 204 status meaning all errors must be managed through exception handling in the service.

Describe the solution you'd like

A more flexible approach would allow the handler to validate and format request data before delegating to the service, without relying solely on exceptions for error handling. This could involve a handler interface with methods that enable custom validation and pre-processing.

Describe alternatives you've considered

Another option is to create custom controllers and bypass the generated ones. However, this approach would prevent the OpenAPI definition from automatically syncing with the custom code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Kotlin Javalin server generator and the generated handler/service integration described in the issue. Review how request validation, preprocessing, service delegation, and multiple 2xx responses are currently represented; done means a documented delegate pattern that preserves synchronization with the OpenAPI definition.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, openapi
Domain
api, backend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.