Skip to content

[BUG][JAVA] vendorExtension.x-class-extra-annotation doesn't generate lists of annotations correctly #23749

@johnyherangi

Description

@johnyherangi

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

The x-class-extra-annotation vendor extension doesn't generate lists of annotations correctly.

openapi-generator version

7.22.0

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: x-class-extra-annotation test
  version: 0.0.1
paths:
  /:
    get:
      responses:
        '200':
          description: desc
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
components:
  schemas:
    User:
      x-class-extra-annotation:
        - '@CustomAnnotationA'
        - '@CustomAnnotationB'
      properties:
        name:
          type: string

openapi.yaml

Generation Details
openapi-generator-cli generate \
  -i ./openapi.yaml \
  -g java \
  -o ./build/generated/openapi \
  --global-property models,modelDocs=false,modelTests=false \
  --additional-properties=hideGenerationTimestamp=true
Steps to reproduce
  1. Add the x-class-extra-annotation field to your schema using a list of values e.g.
      x-class-extra-annotation:
        - '@CustomAnnotationA'
        - '@CustomAnnotationB'
  1. Run the generator with the CLI command above
Expected output
@javax.annotation.Generated(...)
@CustomAnnotationA
@CustomAnnotationB
public class User {
 // ...
}
Actual output
@javax.annotation.Generated(...)
[@CustomAnnotationA, @CustomAnnotationB]
[@CustomAnnotationA, @CustomAnnotationB]
public class User {
 // ...
}
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