OpenAPITools / OpenAPITools/openapi-generator

[REQ][Kotlin-Spring] Option to always include OpenAPI spec file in resources for kotlin-spring generator

Open
#21,832 1 comment 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.

Currently, when using the kotlin-spring generator, the OpenAPI spec file (e.g., openapi.yaml) is only included in the generated resources folder under certain conditions (such as when not using the interface-only approach). This behavior is not always intuitive and can be limiting for users who wish to have the spec file included regardless of generation mode. For example, having the spec in resources is important for runtime documentation, validation, or tooling, even with interface-only generation.

Describe the solution you'd like

Please provide an explicit generator option (not necessarily a CLI option, but could also be set via config) such as includeApiSpecInResources to control whether the OpenAPI spec file is included in the generated resources. This option should work independently of the generation mode (including interface-only). The default behavior could remain unchanged, but this new option would provide much more flexibility for users with different needs.

Describe alternatives you've considered

  • Manually copying the spec file after generation (not ideal, error-prone).
  • Modifying the generator code locally (not maintainable).
  • Using a custom post-processing script (adds complexity).

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 tracing the kotlin-spring generator's handling of the OpenAPI spec when interface-only generation is enabled. Identify where generation mode controls inclusion in the resources folder, then define the new option's default and independent behavior. Done means the option controls spec inclusion across generation modes without changing the default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, spring
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.