Skip to content

[BUG][Java][serializableModel] Generated inner-enum lack implements Serializable #23082

@Chrimle

Description

@Chrimle

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Inner enums lack implements Serializable, while outer/standalone does not.
Discovered here: Chrimle/openapi-to-java-records-mustache-templates#578
Same root cause as #23083

openapi-generator version

7.20.0

OpenAPI declaration file content or url
components:
  schemas:
    ExampleWithInnerEnums:
      type: object
      description: Example with inner enum class
      properties:
        exampleInner:
          type: string
          description: Example of an inner enum class
          enum:
            - ENUM1
            - ENUM2
            - ENUM3

Generates:

  @JsonAdapter(ExampleInnerEnum.Adapter.class)
  public enum ExampleInnerEnum {

But should be:

  @JsonAdapter(ExampleInnerEnum.Adapter.class)
  public enum ExampleInnerEnum implements Serializable {
Generation Details

Library: java
serializableModel: true

Steps to reproduce
Related issues/PRs
Suggest a fix

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