Popularity
7.1
Growing
Activity
9.1
Growing
263
14
48

Description

Most GraphQL libraries require developers to maintain two sources of truth for their GraphQL API: the schema and the corresponding code (data fetchers or resolvers, and types). Given the similarities between Kotlin and GraphQL, such as the ability to define nullable/non-nullable types, a schema can be generated from Kotlin code without any separate schema specification. graphql-kotlin builds upon graphql-java to allow code-only, or resolver-first, GraphQL services to be built.

For information on GraphQL, please visit the GraphQL website.

For information on graphql-java, please visit GraphQL Java.

Programming language: Kotlin
Tags: Web     Graphql     Api     Generator    
Latest version: v1.0.0

GraphQL Kotlin alternatives and similar libraries

Based on the "Web" category

Do you think we are missing an alternative of GraphQL Kotlin or a related project?

Add another 'Web' Library

README

GraphQL Kotlin

Build Status codecov Docs Awesome Kotlin Badge

GraphQL Kotlin consists of number of libraries that aim to simplify running a GraphQL server in Kotlin.

📦 Modules

⌨️ Usage

Below is a basic example of how graphql-kotlin-schema-generator converts your Kotlin code into a GraphQL schema. For more details, see our documentation below or in the individual module READMEs

// Your existing Kotlin code

data class Widget(val id: Int, val value: String)

class WidgetService {
  fun widgetById(id: Int): Widget? {
    // grabs widget from a data source, might return null
  }
}

// Generate the schema

val config = SchemaGeneratorConfig(supportedPackages = listOf("org.example"))
val queries = listOf(TopLevelObject(WidgetService()))

toSchema(config, queries)

will generate

type Query {
  widgetById(id: Int!): Widget
}

type Widget {
  id: Int!
  value: String!
}

📋 Documentation

Examples and documentation are available on our documentation, or in each module README file.

If you have a question about something you can not find in our documentation, the indivdual modules, or javadocs, feel free to create an issue and tag it with the question label.

👥 Contact

This project is part of Expedia Group Open Source but also maintained by a dedicated team

✏️ Contributing

To get started, please fork the repo and checkout a new branch. You can then build the library locally with Maven

```shell script mvn clean install



See more info in [CONTRIBUTING.md](CONTRIBUTING.md)

## ⚖️ License
This library is licensed under the [Apache License, Version 2.0](LICENSE)


*Note that all licence references and agreements mentioned in the GraphQL Kotlin README section above are relevant to that project's source code only.