You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To support this, I'd like to rewrite the parser, which is currently using the (horrible!) Android JSON library.
I first took a look at https://app.quicktype.io/ and the generated source code. I like that it's based on Jackson, but it uses some Java 8 standard library functions that are not part of Android API21 and would need to be rewritten.
I thought about simplifying the generated code using plain Jackson calls, but that also seems quite a lot of work.
In the end, I saw that Kotlin has a new serialization framework that makes (de)serialization quite easy. I don't have much Kotlin experience, but it's definitely a nice language!
So TL;DR: Here's a new project I started, that should provide a standalone lenient Kotlin/Java parser for SpaceAPI endpoints. https://github.com/spaceapi-community/spaceapi-kt The goal is to have a single library / wrapper type that can parse both v0.13 and v14 endpoints (and future versions as well). The focus is on parsing, not on serializing, so we can skip a lot of validation logic.
Kotlin has nice Java interop, so Kotlin can call Java and vice versa. The only cost is that the Kotlin runtime needs to be integrated as a Gradle dependency, which makes the app a bit larger. On the other hand we then have the option of using Kotlin as well in the app code.
(Maybe it's also possible to convert the library into pure-JVM bytecode that does not require the Kotlin runtime, but I doubt it.)
@rorist do you see any problem with this approach? Would you accept a PR that replaces the parser with this library?
The text was updated successfully, but these errors were encountered:
I tested the deserialization with a local JAR file and it already works 🙂 I plan to publish the spaceapi-kt library on Bintray though, then we can pull it in using Gradle.
Last week we released v14 of the SpaceAPI schema! https://github.com/SpaceApi/schema/blob/master/MIGRATION.md
To support this, I'd like to rewrite the parser, which is currently using the (horrible!) Android JSON library.
I first took a look at https://app.quicktype.io/ and the generated source code. I like that it's based on Jackson, but it uses some Java 8 standard library functions that are not part of Android API21 and would need to be rewritten.
I thought about simplifying the generated code using plain Jackson calls, but that also seems quite a lot of work.
In the end, I saw that Kotlin has a new serialization framework that makes (de)serialization quite easy. I don't have much Kotlin experience, but it's definitely a nice language!
So TL;DR: Here's a new project I started, that should provide a standalone lenient Kotlin/Java parser for SpaceAPI endpoints. https://github.com/spaceapi-community/spaceapi-kt The goal is to have a single library / wrapper type that can parse both v0.13 and v14 endpoints (and future versions as well). The focus is on parsing, not on serializing, so we can skip a lot of validation logic.
Kotlin has nice Java interop, so Kotlin can call Java and vice versa. The only cost is that the Kotlin runtime needs to be integrated as a Gradle dependency, which makes the app a bit larger. On the other hand we then have the option of using Kotlin as well in the app code.
(Maybe it's also possible to convert the library into pure-JVM bytecode that does not require the Kotlin runtime, but I doubt it.)
@rorist do you see any problem with this approach? Would you accept a PR that replaces the parser with this library?
The text was updated successfully, but these errors were encountered: