-
Notifications
You must be signed in to change notification settings - Fork 620
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
Additional metadata in classdesc #137
Comments
For first option of knowing nullability/optionality we have pending requests: #71 #58 will be resolved when it would be possible to pass this information, so we're considering it as a useful feature. I don't understand points two and three, though. Class kind is available from descriptor inside |
I know that class kind is available in writeBegin (or readBegin for the parameter). I've looked at my code and this is where I use it for:
Not in the current code, but I would like to be able to generate a schema from the serializer. Overall this should be able to be done merely by adding a reference to the referred loader/saver (and having the loader/saver be required to provide child classdesc).. |
Provided design for |
I've been writing a serializer for xml. It's been a bit of a struggle. In particular I found that the metadata provided in
KSerialClassDesc
is insufficient. If I want to support existing formats (rather than a serialization that is convenient to work with for Kotlin serialization). I need to be able to know more about the children of an element (note that this information is already available and embedded into the serializer/deserializer):this requires those missing values to be provided for reading as being null. Optional values can just be
omitted. For list-like types I'd like to provide an empty list for non-optionals (which break in many other
ways for non-trivial classes).
serialize it as body text, attribute or element. (list elements are natural as body text - a single element
could be an attribute)
Currently I work around this by "retrieving" the information myself. I've created CanaryInput and CanaryOuput classes that simulate reading/writing and record what the loader/saver actually does. For loading this involves throwing and catching exceptions (I don't have actual values). For saver it depends on the data being saved so it could be incomplete (if a value is null I don't get to see what type it is when not null). The input is more complete in what information it can retrieve, but this is still rather much a pain.
The text was updated successfully, but these errors were encountered: