Skip to content

[REQ] Add @Generated annotation to EnumConverterConfiguration for JavaSpring generator #23923

@jorgerod

Description

@jorgerod

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

When using the spring generator (JavaSpring), the supporting file EnumConverterConfiguration.java is generated without the @Generated annotation. All other generated files (models, API interfaces, delegate interfaces, etc.) are correctly annotated with @Generated via the generatedAnnotation partial. This inconsistency means tools that use @Generated to skip static analysis, formatting, or coverage checks (e.g., Checkstyle, JaCoCo, SonarQube) will incorrectly process EnumConverterConfiguration as hand-written code.

Describe the solution you'd like

Update modules/openapi-generator/src/main/resources/JavaSpring/converter.mustache to include:

  1. The jakarta.annotation.Generated import (using {{javaxPackage}}):

    import {{javaxPackage}}.annotation.Generated;
  2. The {{>generatedAnnotation}} partial before the class declaration, consistent with pojo.mustache, api.mustache, etc.:

    {{>generatedAnnotation}}
    
    @Configuration(value = "{{configPackage}}.enumConverterConfiguration")
    public class EnumConverterConfiguration {

The resulting generated file would look like:

import jakarta.annotation.Generated;
// ...

@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", ...)
@Configuration(value = "com.example.config.enumConverterConfiguration")
public class EnumConverterConfiguration {
    // ...
}

Describe alternatives you've considered

  • Overriding converter.mustache locally in each project — works but requires every consumer to maintain a copy and track upstream changes manually.

Additional context

  • The issue affects at least the JavaSpring generator (spring generator name). Other generators with a similar converter.mustache (e.g., java-micronaut-server) may be affected too.
  • pojo.mustache, api.mustache, and apiDelegate.mustache all already use {{>generatedAnnotation}} as a reference for the correct pattern.
  • generatedAnnotation.mustache (the partial) already exists and handles the hideGenerationTimestamp flag correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions