Coder Social home page Coder Social logo

cybernetics / graphql-kotlin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from expediagroup/graphql-kotlin

0.0 1.0 0.0 3.07 MB

Libraries for running GraphQL in Kotlin

Home Page: https://expediagroup.github.io/graphql-kotlin

License: Apache License 2.0

Kotlin 98.91% HTML 0.58% JavaScript 0.49% CSS 0.03%

graphql-kotlin's Introduction

GraphQL Kotlin

Build Status Docs codecov Slack

GraphQL Kotlin is a collection of libraries built on top of graphql-java 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

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!
}

Then using graphql-kotlin-spring-server you can easily make your schema available as a GraphQL server with Spring Boot.

// Mark the class as a Spring GraphQL Query
@Component
class WidgetService : Query {
  fun widgetById(id: Int): Widget? {}
}

@SpringBootApplication
class Application

fun main(args: Array<String>) {
    runApplication<Application>(*args)
}

📋 Documentation

Examples and documentation are available on our documentation site hosted in GitHub Pages.

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

If you would like to contribute to our documentation see the website directory for more information.

👥 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 Gradle

./gradlew clean build

See more info in CONTRIBUTING.md

⚖️ License

This library is licensed under the Apache License, Version 2.0

graphql-kotlin's People

Contributors

aarestu avatar acidbluebriggs avatar bakert avatar benimario avatar bherrmann2 avatar brennantaylor avatar d4rken avatar dariuszkuc avatar de55 avatar dennisfen avatar experdelfavero avatar gklijs avatar goregius avatar gscheibel avatar larslorenzen avatar lasanthak avatar lennyburdette avatar lykims avatar macarse avatar neetkee avatar rharriso avatar rickfast avatar sgeb avatar smyrick avatar sullis avatar sundeep-expedia avatar swiftrs avatar tapaderster avatar tk26 avatar tobias-f avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.