-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Enum naming strategy should allow different naming conventions used in source code #4675
Comments
I am not 100% sure if this can be done reliably, but if so, sounds like a reasonable idea. |
I believe naming conventions wrt Enum is somewhat controversial. As far as I know it is conventional to use
So it might be safer off to provide extension points instead of declaring what Enum naming would be. |
Sounds like something that https://github.com/FasterXML/jackson-module-kotlin can/should(?) support out-of-the-box: internal class KotlinAnnotationIntrospector(...) {
...
override fun findEnumNamingStrategy(config: MapperConfig<*>, ac: AnnotatedClass): Any? {
return PascalCaseOrCamelCaseStrategy()
}
} |
@yihtserns Perhaps, although if so, should only apply to Kotlin Enum types? And be configurable to allow disabling such logic. |
I think so far nobody from Java side has ever requested such thing, right? The reason this issue was created is because only Kotlin side has such "double standard". 🤐 EDIT: Oh you mean internal class KotlinAnnotationIntrospector(...) {
...
override fun findEnumNamingStrategy(config: MapperConfig<*>, ac: AnnotatedClass): Any? {
if (ac.annotated.isKotlinClass()) {
return PascalCaseOrCamelCaseStrategy()
}
return null
}
} |
Right, if there are reliable means to detect that information. Similar to how Kotlin special sauce avoided (I think?) for POJOs. |
Is your feature request related to a problem? Please describe.
Currently
CamelCaseStrategy
inEnumNamingStrategies
assumes that enum entires in source code are named using UPPER_SNAKE_CASE convention, for example:enum Size { VERY_BIG }
.However in Kotlin quite often UpperCamelCase is used, for example
enum class Size { VeryBig }
.CamelCaseStrategy
inEnumNamingStrategies
does not work with such a naming.Describe the solution you'd like
Strategies in
EnumNamingStrategies
should work with enum entries written in code using different naming conventions like UpperCamelCase .Usage example
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: