Skip to content

[REQ][kotlin-spring] Option to disable ResponseEntity wrapping in kotlin-spring generator #21833

@takkiraz

Description

@takkiraz

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

Currently, the kotlin-spring generator always wraps return types in ResponseEntity<>, e.g., generating methods like ResponseEntity<UserDto>. There is no configuration option to disable this behavior and have endpoints return the model object directly (e.g., UserDto). The Java spring generator provides some related options, but this is missing from the kotlin-spring generator.

Describe the solution you'd like

Add a configuration option (such as useResponseEntity or similar) to the kotlin-spring generator to allow disabling ResponseEntity as the return type. When disabled, generated endpoints should return the model type directly, matching the OpenAPI schema response type.

Describe alternatives you've considered

  • Overriding generator templates locally to remove ResponseEntity wrapping (workaround, but inconvenient and hard to maintain)
  • Using another generator (not ideal if kotlin-spring features are required)

Additional context

Other OpenAPI Generator users have requested similar flexibility as is available in the Java spring generator (e.g., with generateGenericResponseEntity). This feature would improve parity and make the kotlin-spring generator more customizable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions