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
Kotlin inheritance with non-settable properties #835
Comments
This is happening because we only handle supertype properties if they're mutable. The logic to fix this would be to include "not settable" properties and filter those out during fromJson. I can see why it'd be expected to appear in toJson, but at the same time worry about the possible asymmetry of fromJson ignoring them and toJson not ignoring them. @swankjesse @JakeWharton @rharter penny for your thoughts? |
FWIW - |
Our rules are pretty simple: Moshi wants to both read and write JSON properties. If you have a property whose API permits writes but not reads, that’s a problem because it prevents you from testing your JSON. |
If I have an open class and inherited data class from it, Kotlin-moshi codegen skip default values. Is this intended behaviour or bug?
produces only
{"test":"test"} , w/out foo default value.
The text was updated successfully, but these errors were encountered: