CloudStreamPackage: migrate to kotlinx serialization#2878
Open
Luna712 wants to merge 3 commits into
Open
Conversation
| @JsonProperty("uri") | ||
| @JsonProperty("uri") @SerialName("uri") | ||
| @Serializable(with = UriSerializer::class) | ||
| val uri: Uri?, |
Collaborator
There was a problem hiding this comment.
I think we've run into the first null issue from #2897
Java.lang.AssertionError: Serialization mismatch for:
com.lagradost.cloudstream3.actions.temp.CloudStreamPackage.MinimalVideoLink
Jackson:
{"uri":null,"url":"YRZOHJ","mimeType":"QSIUJMXEP","name":"NHOIYX","headers":{"UDHQNR":"CZDV","CQTCZKYKWN":"KGRYBRD","DXAOWNP":"XDQXGLZAOC"},"quality":1779}
Kotlinx:
{"url":"YRZOHJ","mimeType":"QSIUJMXEP","name":"NHOIYX","headers":{"UDHQNR":"CZDV","CQTCZKYKWN":"KGRYBRD","DXAOWNP":"XDQXGLZAOC"},"quality":1779}
However, this can be sidestepped by making Instancio create a valid Uri-type (we should really have this for all troublesome types):
val instance = Instancio.of(kClass.java).lenient().supply(all(Uri::class.java), Supplier {
Uri.parse("https://example.com")
}).create()But this gives
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Direct self-reference leading to cycle (through reference chain: com.lagradost.cloudstream3.actions.temp.CloudStreamPackage$MinimalVideoLink["uri"]->android.net.Uri$StringUri["canonicalUri"])
Meaning that Jackson actually cannot serialize it properly 😬
Perhaps we also need custom JsonDeserializer for jackson? What do you think is best?
Contributor
Author
There was a problem hiding this comment.
Tbh I think the best option here is to add a temporary annotation that can skip certain classes in tests and drop worrying about Jackson for things like this. I feel focusing on fixing Jackson to match kotlinx exactly is a waste of time for things like this when Jackson is being phased out. But it is up to you.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.