Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [Spring] [Java] additionalModelTypeAnnotations not applied to enums #6055

Open
5 of 6 tasks
ondrakucera opened this issue Apr 25, 2020 · 4 comments
Open
5 of 6 tasks

Comments

@ondrakucera
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Option additionalModelTypeAnnotations isn't applied to enums.

openapi-generator version

4.3.0

OpenAPI declaration file content or url
swagger: "2.0"
info:
    title: Book
    version: 1.0.0
paths:
    /books:
        get:
            summary: Get books
            responses:
                200:
                    description: Successful response
                    schema:
                        type: array
                        items:
                            $ref: '#/definitions/Book'
definitions:
    Book:
        description: Book
        type: object
        properties:
            type:
                $ref: '#/definitions/BookType'
    BookType:
        description: Book type
        type: string
        enum:
            - HARDCOVER
            - PAPERBACK
            - ELECTRONIC
Command line used for generation
generate -g spring -p additionalModelTypeAnnotations=@Foo,hideGenerationTimestamp=true
generate -g java -p additionalModelTypeAnnotations=@Foo,hideGenerationTimestamp=true
Steps to reproduce

Generate the code and see the following:

Book.java:

...
/**
 * Book
 */
@ApiModel(description = "Book")
@Foo

public class Book   {
  ...
}

BookType.java

/**
 * Book type
 */
public enum BookType {
  ...
}
Related issues/PRs
Suggest a fix
@auto-labeler
Copy link

auto-labeler bot commented Apr 25, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@mutyasaisrikar
Copy link

any update on this issue?

@borsch
Copy link
Member

borsch commented Jan 9, 2021

@ondrakucera @mutyasaisrikar please check this one #8389

@ondrakucera
Copy link
Author

@borsch Thanks. I agree with the general approach (a new option) but I can't really comment on the particular changes made in the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants