GraphQL toolkit for Kotlin.

Overview

GraphQL Kotlin Toolkit

GitHub Actions codecov Maven Central Maven Central

A toolkit for GraphQL, specifically for Kotlin. This toolkit provides some useful tools that are compatible with graphql-java.

Code generation

This tool follows the schema-first approach, in which you first write your schema.graphqls files and implement the server-side code for it afterwards. This code generator additionally creates an interface for each resolver. These can be used to implement each resolver in a clean way. The tool also provides specific parameters for each argument, allowing a more type safe way to access the incoming data. This code generator also supports Kotlin's null safety feature!

Example resolver:

class MutationUpdateUser : GQLMutationUpdateUser {
    override fun resolve(input: GQLUpdateUserInput, env: GQLMutationUpdateUser.Env): User {
        TODO("implement your resolver")
    }
}

Getting started here!

Spring Boot integration

This integration works in a more opinionated way as it provides additional annotations which can be used to register code for various GraphQL types. It also comes with a servlet, which handles all GraphQL requests.

Getting started here!

Documentation

You might also like...
A simple reference example Kotlin GraphQL service

A simple reference example Kotlin GraphQL service, written for colleagues coming over from Python & FastAPI/Flask + Ariadne/Graphene.

GraphQL for Java with Spring Boot made easy.

GraphQL for Java with Spring Boot made easy.

Restful Toolkit for IntelliJ IDEA

restful-toolkit Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get known with the template documentation. Verify the plugi

Server & Web App of Tolgee localization toolkit
Server & Web App of Tolgee localization toolkit

Server & Web App of Tolgee localization toolkit

This repository demonstrates Spring GraphQL + RSocket + WebFlux + R2DBC + H2

Reactive GraphQL with Spring This repository demonstrates Spring GraphQL + RSocket + WebFlux + R2DBC + H2 O__ +-----------+

PeopleInSpace GraphQL Server

PeopleInSpace GraphQL Server GraphQL backend allowing querying list of people in

Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

Koltin Multplatform Project that interacts with a GraphQL server to display golf scores, player and weather information.
Koltin Multplatform Project that interacts with a GraphQL server to display golf scores, player and weather information.

GolfScoresKMM Koltin Multplatform Project that interacts with a GraphQL server to display golf scores, player and weather information. The app is setu

Mock up social media android application created to interact with a backend Java server using GraphQL.

The Community Board Project Authorship: author: dnglokpor date: may 2022 Project Summary: The Community Board Project consists of a Java Spring Boot b

Comments
  • Potential problem: Given resolver

    Potential problem: Given resolver "User.emailAddress" and "UserEmail.Address" would clash

    If there are two resolvers, say "User.emailAddress" and "UserEmail.address", there would be a clash, because the code generator would output "UserEmailAddress" for "User.emailAddress" and "UserEmailAddress" for "UserEmail.address".

    bug module: codegen 
    opened by WipeAir 1
  • Usage of existing enums

    Usage of existing enums

    Sometimes there are already existing enums for the ones used in the GraphQL schema. The code generator will currently always generate a new enum, which matches the one defined in the schema.

    This behavior sometimes results in unnecessarily ugly code, therefore there should be an easier way to do that.

    Possible fixes:

    • Allow kRepresentation on Enums to directly use the existing enum.
      • Is there a way to guarantee that the given enum contains the required values? (Would break type safety and runtime otherwise)
    enhancement module: codegen 
    opened by WipeAir 1
  • Specify type for scalar

    Specify type for scalar "ID" explicitly (with converter)

    There should be the possibility to set an explicit type for the "ID" scalar. This functionality should also come with a convert, as the ID is typically given as a String.

    This may be implemented like this:

    • Two new properties within the CodegenOptions. (Reference to the ID type and the converter implementation)
    • Special handling for the ID scalar within the TypeMapper.
    • Generate a converter interface.
    enhancement module: codegen 
    opened by WipeAir 0
  • Pagination field resolvers: Support for own types and validation

    Pagination field resolvers: Support for own types and validation

    The current implementation of the pagination field resolvers requires the return type of a field to be a list (e.g. [User]). But the generator should also support own *Connection and *Edge types. When bringing in their own types, the generator should validate them against the GraphQL Cursor Connections Specification.

    The user should also be able to define additional fields on the *Connection and *Edge types. When additional fields are given the generator has to generate specific Kotlin classes to support those. (Currently, global Kotlin classes are being used (PaginationConnectionGenerator, PaginationEdgeGenerator))

    The pagination field resolvers should also properly handle the nullability of the types.

    enhancement module: codegen 
    opened by WipeAir 0
Releases(v0.6.3)
  • v0.6.3(Oct 4, 2020)

  • v0.6.1(Sep 13, 2020)

  • v0.6.0(Aug 12, 2020)

  • v0.5.0(Jun 26, 2020)

    Features:

    • (codegen) Add @Suppress("UNCHECKED_CAST") to resolver functions
    • (codegen) Add the name of the field container to the package to avoid resolver interface clashes (Breaking change) #3
    • (codegen) Add input/output functions to generated enums to simplify usage with existing enums #1
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Jun 8, 2020)

    Fixes:

    • (codegen) Fix some compiler warnings

    Internal:

    • Updated all dependencies to their last versions
    • Buildscript has been refactored
    • New tests have been written

    graphql-java has been updated to 15.0, which introduces some new features.

    Source code(tar.gz)
    Source code(zip)
  • v0.3.3(Jun 1, 2020)

    Fixes:

    • (spring boot) Allow nested variables
    • (codegen) Add "Char" to scalar mapping

    Additionally, the documentation has been slightly updated and the test coverage has been increased.

    Source code(tar.gz)
    Source code(zip)
  • v0.3.2(Apr 25, 2020)

  • v0.3.1(Mar 21, 2020)

    Fixes:

    • (codegen) "startCursor" and "endCursor" on PageInfo is no optional, as the edges may be empty
    • (spring-boot) remove unnecessary println
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Mar 21, 2020)

    Features:

    • (codegen & spring-boot) Implement pagination (See here)
    • (codegen) The codegen will now generate interfaces instead of abstract classes for field resolvers
    • (codegen) Rename the Environment class for field resolvers to Env

    Other:

    • Internal refactorings
    Source code(tar.gz)
    Source code(zip)
  • v0.2.4(Mar 7, 2020)

  • v0.2.3(Mar 6, 2020)

    Features:

    • (codegen) Refactored directives (includes additional schema validation)

    Fixes:

    • (codegen) Map scalar "Float" to a Double instead of a Float
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(Feb 29, 2020)

  • v0.2.1(Feb 15, 2020)

  • v0.2.0(Feb 15, 2020)

  • v0.1.0(Jan 5, 2020)

GraphQL Jetpack - A collection of packages for easily writing Java GraphQL server implementations

GraphQL Jetpack A collection of packages for easily writing Java GraphQL server

Ryan Yang 18 Dec 2, 2022
Victor Hugo 1 Feb 2, 2022
A sample skeleton backend app built using Spring Boot kotlin, Expedia Kotlin Graphql, Reactive Web that can be deployed to Google App Engine Flexible environmennt

spring-kotlin-gql-gae This is a sample skeleton of a backend app that was built using: Spring Boot(Kotlin) Reactive Web Sprinng Data R2DBC with MYSQL

Dario Mungoi 7 Sep 17, 2022
Kotlin backend based on the Clean Architecture principles. Ktor, JWT, Exposed, Flyway, KGraphQL/GraphQL generated endpoints, Gradle.

Kotlin Clean Architecture Backend Kotlin backend based on the Clean Architecture principles. The application is separated into three modules: Domain,

null 255 Jan 3, 2023
🗼 yukata (浴衣) is a modernized and fast GraphQL implementation made in Kotlin

?? yukata 浴衣 - Modernized and fast implementation of GraphQL made in Kotlin yukata is never meant to be captialised, so it'll just be yukata if you me

Noel 5 Nov 4, 2022
An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL

graphql-kotlin-spring-server An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL Running the s

null 0 Oct 31, 2021
FirestoreCleanArchitectureApp is an app built with Kotlin and Firestore that displays data in real-time using the MVVM Architecture Pattern. For the UI it uses Jetpack Compose, Android's modern toolkit for building native UI.

FirestoreCleanArchitectureApp FirestoreCleanArchitectureApp is an app built with Kotlin and Cloud Firestore that displays data in real-time using Andr

Alex 66 Dec 15, 2022
Example project for using the Selenium toolkit with Kotlin, Maven, TestNg and the config is managed via a property file.

Selenium-Java-Toolkit-TestNg-Playground This is the sample-Project and show you how to use the Selenium-Toolkit. The Selenium-Toolkit is a Java based

Selenium Consulting 0 Dec 15, 2021
A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.

Apex Apex is just a simple proof of concept to demonstrate how easily you can build your own UI Toolkit from scratch. This code base is most likely fu

Romain Guy 79 Sep 7, 2022
A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.

Apex Apex is just a simple proof of concept to demonstrate how easily you can build your own UI Toolkit from scratch. This code base is most likely fu

Romain Guy 79 Sep 7, 2022