Skip to content
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

Serializing dynamic models aren't supported right now #284

Open
KirkBushman opened this issue Feb 12, 2019 · 5 comments
Open

Serializing dynamic models aren't supported right now #284

KirkBushman opened this issue Feb 12, 2019 · 5 comments

Comments

@KirkBushman
Copy link

KirkBushman commented Feb 12, 2019

I'm trying to convert a Comment instance to a json string and vice-versa.
I'm using two extensions function to do this:

 fun Comment.toJson(): String = commentAdapter.toJson(this)
 fun fromJsonComment(json: String): Comment? = commentAdapter.fromJson(json)

where comment adapter is:

val commentAdapter by lazy { Comment.jsonAdapter(JrawUtils.moshi).serializeNulls() as JsonAdapter<Comment> }

and I'm getting this error:
Serializing dynamic models aren't supported right now

but with the same exact method it's working fine with all the others model: Submissions, Subreddit, Message, Account...

Am I getting something wrong? Does it need a different approach?

Thanks in advance

@saket
Copy link
Contributor

saket commented Feb 13, 2019

Related: #237

@KirkBushman
Copy link
Author

Is there something I can do? were you already working on something?
In the meantime I guess I can use Comment as a Serializable or parse to string by hand...

@saket
Copy link
Contributor

saket commented Feb 13, 2019

@KirkBushman try out my fix commit and see if it works for you?

@KirkBushman
Copy link
Author

I'll do as soon as I can

@KirkBushman
Copy link
Author

I had exams in the way, sorry for being late. (by a lot)

Yes your fix is working, now I've got to decide what to do...
Because this library is very good but it needs to be maintained, I could just go on with a fork e add my fixes, at this point.

Your fork is 32 commits behind, it is missing a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants