kgbier/graphql-parser-kotlin

Making it multiplatform

beepsoft opened this issue · 4 comments

Hi,

I just stumbled upon your project while looking for a pure Kotlin graphql parser I could use in my Kotlin multiplatform lib. And it looks great!

It seems that your lib works platform independently except from the modelreader package, which uses kotlin.reflect.full.declaredMemberProperties

Do you have plans to turn this into a multiplatform implementation?

I'm at the beginning to experiment with Kotlin multiplatform so I don't know too much about it, but it doesn't seem difficult with the current state of graphql-parser-kotlin to make it multiplatform.

Hey @beepsoft, there aren't any plans to maintain this, but I was curious about multiplatform so I gave it a crack.
Looks like kotlin.text's Char.isDigit and Char.isLetterOrDigit need some platform implementations (not available in JS) but other than that it wasn't too painful.

Yes, I just realized too that isDigit and friends are missing from javascript platform, but are available (and work in graphql-parser-kotlin) in jvm and native. Too bad. However I like the idea of a multiplatform graphql-parser-kotlin so I will ask around the forums to see whether we can make this work.

I added a JS target and simple implementations of isDigit/isLetterOrDigit

Nice! I tried to find a way to add isDigit to kotlin.text.Char for JS, so that your code could be used without change but that doesn't seem possible. Using a custom isDigit/isLetterOrDigit as you did seems the only possible way for now.

As this is now a truly multiplatform lib you may add it to https://github.com/AAkira/Kotlin-Multiplatform-Libraries, what do you think?

By the way, I really appreciate how you are not maintaining this project. 😃