apollo-kotlin icon indicating copy to clipboard operation
apollo-kotlin copied to clipboard

Apollo kotlin server

Open ronjunevaldoz opened this issue 1 year ago • 1 comments

Use case

Kotlin based graphql server. There are some existing kotlin server libraries:

  • https://github.com/apurebase/kgraphql/ (Pure kotlin and declarative)
  • https://github.com/ExpediaGroup/graphql-kotlin (Adaptation of graphql java, not declarative)

Describe the solution you'd like

If I were to choose, I would choose the approach of kgraphql due to it's best suited for pure and declarative, the only problem is kgraphql maintainers are lacking and seems to be abandoned by the original owner while expedia graph-kotlin is an active community.

feature must support the following

  • pure kotlin
  • declarative like kgraphql
  • able to install ktor plugins (version 3.x.x if possible)
  • less boilerplate
  • easy to add queries, mutations, subscriptions
data class Article(val id: Int, val text: String)

fun main() {
    val schema = KGraphQL.schema {
        query("article") {
            resolver { id: Int?, text: String ->
                Article(id ?: -1, text)
            }
        }
        type<Article> {
            property<String>("fullText") {
                resolver { article: Article ->
                    "${article.id}: ${article.text}"
                }
            }
        }
    }

    schema.execute("""
        {
            article(id: 5, text: "Hello World") {
                id
                fullText
            }
        }
    """.trimIndent()).let(::println)
}

Please leave a comment about this feature requests. I would love to help to build this library.

ronjunevaldoz avatar Oct 10 '24 12:10 ronjunevaldoz

Hi 👋 Thanks for the feature request. We'll discuss that with the team and update this issue.

martinbonnin avatar Oct 10 '24 12:10 martinbonnin

We do have an experimental server implementation in https://github.com/apollographql/apollo-kotlin-execution. As of now this is experimental, and not ready to use in production, but if you want to have a look, feedback is warmly welcome.

BoD avatar Oct 25 '24 10:10 BoD

I'll close this for now - please report any issue to the dedicated repo.

BoD avatar Oct 25 '24 10:10 BoD