Skip to content

Commit 3eeb3cd

Browse files
committed
openapi-processor/openapi-processor-spring#198, pass new option to processor
1 parent 5a0a1a9 commit 3eeb3cd

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/ApiOptions.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ class ApiOptions {
5151
*/
5252
var modelType = "default"
5353

54+
/**
55+
* enum type. default|string|framework.
56+
*/
57+
var enumType = "default"
58+
5459
/**
5560
* suffix for model class names and enum names. Default is none, i.e. an empty string.
5661
*/

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/OptionsConverter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class OptionsConverter(private val checkObsoleteProcessorOptions: Boolean = fals
5757
is MappingV2 -> {
5858
options.packageName = mapping.options.packageName
5959
options.modelType = mapping.options.modelType
60+
options.enumType = mapping.options.enumType
6061
options.modelNameSuffix = mapping.options.modelNameSuffix
6162

6263
val (enable, format) = checkBeanValidation(mapping.options)

openapi-processor-core/src/test/kotlin/io/openapiprocessor/core/converter/OptionsConverterSpec.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class OptionsConverterSpec: StringSpec({
2323
options.beanValidation shouldBe false
2424
options.javadoc shouldBe false
2525
options.modelType shouldBe "default"
26+
options.enumType shouldBe "default"
2627
options.modelNameSuffix shouldBe String.Empty
2728
options.typeMappings shouldHaveSize 0
2829
options.formatCode.shouldBeFalse()
@@ -94,6 +95,8 @@ class OptionsConverterSpec: StringSpec({
9495
options:
9596
package-name: generated
9697
model-name-suffix: Suffix
98+
model-type: record
99+
enum-type: string
97100
bean-validation: true
98101
javadoc: true
99102
format-code: false
@@ -102,6 +105,8 @@ class OptionsConverterSpec: StringSpec({
102105

103106
options.packageName shouldBe "generated"
104107
options.modelNameSuffix shouldBe "Suffix"
108+
options.modelType shouldBe "record"
109+
options.enumType shouldBe "string"
105110
options.beanValidation shouldBe true
106111
options.javadoc shouldBe true
107112
options.formatCode.shouldBeFalse()

0 commit comments

Comments
 (0)