Skip to content

Commit 7a6ba78

Browse files
committed
want upper case enum class name
1 parent ea1d389 commit 7a6ba78

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/groovy/com/github/hauner/openapi/spring/converter/DataTypeConverter.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,14 @@ class DataTypeConverter {
211211
return new StringDataType ()
212212
}
213213

214+
// in case of an inline definition the name may be lowercase, make sure the enum
215+
// class gets an uppercase name!
214216
def enumType = new StringEnumDataType (
215-
type: info.name,
217+
type: info.name.capitalize (),
216218
pkg: [options.packageName, 'model'].join ('.'),
217219
values: info.enumValues)
218220

219221
dataTypes.add (enumType)
220-
221222
enumType
222223
}
223224

src/test/groovy/com/github/hauner/openapi/spring/converter/DataTypeConverterEnumSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ paths:
6060
def ep = itf.endpoints.first ()
6161
def param = ep.parameters.first ()
6262
param.name == 'foo'
63-
param.dataType.name == 'foo'
63+
param.dataType.name == 'Foo'
6464
param.dataType.values == ['foo', 'bar', 'foo-bar']
6565
}
6666

@@ -113,7 +113,7 @@ components:
113113

114114
then:
115115
api.models.dataTypes.size () == 2
116-
api.models.dataTypes[0].name == 'foo'
116+
api.models.dataTypes[0].name == 'Foo'
117117
api.models.dataTypes[1].name == 'Bar'
118118
}
119119

0 commit comments

Comments
 (0)