Bug Report Checklist
Description
Originally, #6055 reported the fact that the annotations from additionalModelTypeAnnotations do not get applied to enumerations when using the Java generator. This was subsequently fixed via #8389 by adding a new additionalEnumTypeAnnotations option. However, this only applies to the Java generator, and this option is still missing from the Kotlin generator. As far as I know, there is currently no configuration that applies a certain annotation to all generated enums.
openapi-generator version
using the gradle plugin with version 6.6.0
OpenAPI declaration file content or url
This is the same spec that is given as an example in #6055:
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
Generation Details
Specifying an additionalEnumTypeAnnotations option in the additional properties has no effect on generated enums (because that behaviour has only been implemented for the Java generator)
Steps to reproduce
- run:
generate -g kotlin -p additionalModelTypeAnnotations=@Foo for the given spec
- inspect the generated enum: It does not have the
@Foo annotation
- run:
generate -g kotlin -p additionalEnumTypeAnnotations=@Foo for the given spec
- inspect the generated enum: It does not have the
@Foo annotation
Related issues/PRs
#6055
#8389
Suggest a fix
I suggest adding the additionalEnumTypeAnnotations option to the additional properties of the Kotlin generator, with functionality analogous to the option for the Java generator (#8389).
Bug Report Checklist
Description
Originally, #6055 reported the fact that the annotations from
additionalModelTypeAnnotationsdo not get applied to enumerations when using the Java generator. This was subsequently fixed via #8389 by adding a newadditionalEnumTypeAnnotationsoption. However, this only applies to the Java generator, and this option is still missing from the Kotlin generator. As far as I know, there is currently no configuration that applies a certain annotation to all generated enums.openapi-generator version
using the gradle plugin with version
6.6.0OpenAPI declaration file content or url
This is the same spec that is given as an example in #6055:
Generation Details
Specifying an
additionalEnumTypeAnnotationsoption in the additional properties has no effect on generated enums (because that behaviour has only been implemented for the Java generator)Steps to reproduce
generate -g kotlin -p additionalModelTypeAnnotations=@Foofor the given spec@Fooannotationgenerate -g kotlin -p additionalEnumTypeAnnotations=@Foofor the given spec@FooannotationRelated issues/PRs
#6055
#8389
Suggest a fix
I suggest adding the
additionalEnumTypeAnnotationsoption to the additional properties of the Kotlin generator, with functionality analogous to the option for the Java generator (#8389).