-
Notifications
You must be signed in to change notification settings - Fork 12
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
Tentative fix to deal with issues using generateJSONWithStreaming #247
Conversation
core/src/main/kotlin/com/strumenta/kolasu/serialization/JsonGenerator.kt
Outdated
Show resolved
Hide resolved
|{"#type":"com.strumenta.kolasu.serialization.Content","annidatedContent": | ||
|{"#type":"com.strumenta.kolasu.serialization.Content","annidatedContent": | ||
|{"#type":"com.strumenta.kolasu.serialization.Content","annidatedContent":null,"id":4},"id":3},"id":2}], | ||
|[{"#type":"com.strumenta.kolasu.serialization.Content","id":1}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to add several examples, using the flag shortClassNames set to false and to true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be useful to have tests to load the examples, both with shortClassNames set to false and to true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more examples for generation, still working on deserialization tests.
val actualClass = try { | ||
Class.forName(className) | ||
} catch (ex: ClassNotFoundException) { | ||
Class.forName(rawClass.`package`.name + "." + className) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, does not exist a method that check if a class exist without throwing an exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just about to ask your opinion on this fix. It was needed to pass this test deserializeNodeFromStreamingWithShortNames. It seems that sometimes with simple names cannot find the right class.
I will check for that method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an issue with serializing JSON with streaming for the RPG Parser. The issue is that when generating JSON with streaming there is essentially an alternative serialization process that is not affected by custom serializers and works a bit differently. This tentative fix effectively uses for the serialization with streaming the same methods for normal serialization.
I have also ensured that it is always used the
gsonBuilder
with the custom serializers.However, I do not know if there was a specific reason for using alternative serialization methods for streaming serialization. Maybe I am missing something.