If you deserialize some format. And in the seriali...
# serialization
v
If you deserialize some format. And in the serialized format something has type
String
but the DAO class specifies this property to be
Int
, what is supposed to happen? Should the format implementation automatically parse the String to an
Int
? If so, which formats should be supported? (hexadecimal, ocatal, prefixes, ...) Or should the deserialization fail? Is this specified somewhere? For example @charleskorn’s KAML does parse any
String
that starts wtih
0x
or
0o
or is purely numeric to an
Int
. My question mainly is, whether that is expected in the KxS context, or not. Because afaiu in the YAML context it should only do this conversion if it is unquoted and not explicitly tagged as
!!str
, if it is explicitly marked as
String
by quoting or by using the
!!str
tag, it should stay a
String
as far as YAML format is concerned. But currently it always converts. Just trying to understand whether this behavior is expected in KxS context or whether I should report a bug to KAML.
Anyone?
e
I imagine it would depend based on the format and/or the deserializer.
v
My question was, whether KxS mandates how a format implementation like kaml should behave. If e.g. in the actual data the is the number 1 but in the class there is a String field, should it error out or transform the number to a string. Or if the actual data has the string 1 but in the class there is an integer field, should it error out or parse the string into a number. What about the string 0x0, or the string 0o0, ...
e
That's why I think it's up to the implementation. If you're looking for the KxS team's personal opinion on it opening an issue on the repo would probably get a response.
v
But opening an issue is usually for issues and feature requests, not for question, which is also backed by the available issue templates. This place is for questions. Besides, that the answer does not necessarily have to be from the KxS team, as there could also be some documentation someone else could point to. 🙂
e
One of the templates is design discussion, which might fit, but I get what you're saying.