Conversation
| } | ||
|
|
||
| @Test | ||
| fun testDeserializeUsingSerialNameInsteadOfNamingConvention() { |
There was a problem hiding this comment.
This test was successful only because the value in @SerialName is follow the naming convention 😄
I think it is confusing and not helpful to check anything.
|
@sandwwraith, have I a chance to get review and merge this fix? |
|
I'm a little bit hesitant to add this annotaiton for Hocon, since we do not have a Json equivalent; if same problem arises in Json (it is there for JsonNamingStrategy, for example), maybe we would need a better generalized solution. What are benefits of having this annotation instead of just disabling "useHoconNamingConvention"? Or maybe we need a specific annotation, e.g., |
I don't want to disable this naming convention, because 99% of the fields follow this convention. However, we also need the ability to set a serial name manually from time to time. 🤷♂️
Yes, potentially this solves the problem by using two annotations per field, but it doesn't look so good either. 🤔 @Serializable
data class (
@DisableHoconConvention
@SerialName("unConventionField")
val unConventionField: String
)
Do you mean the situation where one type can be serialized in multiple formats?
We have the |
|
I have looked the options for not having per-format naming annotations. I am not sure that those annotations can be avoided if you want to be able to use the same serializers for different formats (with potentially different names). Even if a functional strategy is used, it would often have to resort to either a built-in translation table or custom annotations. |
It works for deserialization alone. |
@sandwwraith I think in most cases, it's related to deserialization. However, without the ability to set the property name directly for serialization, it seems strange. I still have an opinion that the
|
Current implementation doesn't give users any chance to control the property name in Hocon representation when they use the
useConfigNamingConvention.