apollographql / apollo-kotlin

:rocket:  A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform.
https://www.apollographql.com/docs/kotlin
MIT License
3.75k stars 651 forks source link

Apollo kotlin server #6196

Open ronjunevaldoz opened 1 week ago

ronjunevaldoz commented 1 week ago

Use case

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

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

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.

martinbonnin commented 1 week ago

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