https://github.com/aPureBase/KGraphQL
Pure Kotlin GraphQL implementation
https://github.com/aPureBase/KGraphQL
graphql kotlin
Last synced: 8 months ago
JSON representation
Pure Kotlin GraphQL implementation
- Host: GitHub
- URL: https://github.com/aPureBase/KGraphQL
- Owner: aPureBase
- License: mit
- Fork: true (pgutkowski/KGraphQL)
- Created: 2019-04-29T10:59:16.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T21:50:03.000Z (over 1 year ago)
- Last Synced: 2024-11-14T16:44:57.146Z (about 1 year ago)
- Topics: graphql, kotlin
- Language: Kotlin
- Homepage: https://kgraphql.io
- Size: 2.53 MB
- Stars: 305
- Watchers: 10
- Forks: 58
- Open Issues: 56
-
Metadata Files:
- Readme: README.MD
- License: LICENSE.md
Awesome Lists containing this project
- awesome-graphql - KGraphQL
- fucking-awesome-graphql - KGraphQL
- awesome-list - KGraphQL
README
# KGraphQL
[](https://search.maven.org/search?q=g:%22com.apurebase%22%20AND%20a:%22kgraphql%22)
[](https://github.com/KotlinBy/awesome-kotlin)
[](https://kotlinlang.slack.com/messages/kgraphql)
KGraphQL is a [Kotlin](https://kotlinlang.org/) implementation of [GraphQL](http://graphql.org/). It provides a rich DSL to set up the GraphQL schema.
```kotlin
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 {
property("fullText") {
resolver { article: Article ->
"${article.id}: ${article.text}"
}
}
}
}
schema.execute("""
{
article(id: 5, text: "Hello World") {
id
fullText
}
}
""".trimIndent()).let(::println)
}
```
## Documentation
See the [documentation](https://kgraphql.io/) for a more detailed explanation of the library.
## Contributing
All contributions are welcome. Feel free to open issues and PRs!
## Building
To build KGraphQL you only need to have JDK8 installed. invoke
```bash
./gradlew build
```
To perform local build.
## Versioning
The versioning is following [Semantic Versioning](http://semver.org/)
## Links
Specification : http://facebook.github.io/graphql/
## License
KGraphQL is Open Source software released under the [MIT license](https://opensource.org/licenses/MIT)