https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
graphql-kotlin
  • v

    Volodymyr Korniienko

    02/18/2022, 9:10 AM
    hi! I’m migrating to apollo kotlin v3 and I need to make a decision between
    responseBased
    and
    operationBased
    codegen.
    responseBased
    is claimed to be more performant but generates tons of code that may affect class loading and compilation time. Therefore I’m wondering is there any performance analysis of these two methods based on response size/nested fragments count/any other metric?
    m
    • 2
    • 2
  • t

    Tobias Berger

    02/21/2022, 10:49 AM
    Hi everyone! We just switched from manually written GraphQL schemas to using the Expediagroup schema generator. One thing we noticed is that enums in our generated schema are now sorted alphabetically. Is there some way to avoid this and retain the original order that the enum had in our Kotlin code?
    d
    • 2
    • 9
  • j

    jmfayard

    02/21/2022, 11:54 AM
    Does someone use the GraphQL registry from Apollo? https://www.apollographql.com/docs/rover/ci-cd/#github-actions I enabled it in GitHub Actions, it detects that chnages were made
    │ PASS │ FIELD_REMOVED │ type `HelloPayload`: field
    shinyNewQuery
    removed │
    15 but it isn't error for it because it doesn't know which GraphQL queries and mutations my users are using because I don't use the Apollo Graphql server I don't know what to do https://www.apollographql.com/docs/studio/check-configurations/#using-apollo-studio-recommended
    m
    l
    • 3
    • 3
  • a

    Ashu Gairola

    02/23/2022, 12:15 AM
    Hi folks, Is there a way to add filters to graphQLRoutes that is automatically configured by graphql-kotlin-spring-server? Thanks!
    d
    • 2
    • 5
  • j

    Justin

    03/11/2022, 5:54 PM
    Is this library able to take a
    myschema.graphql
    schema file as input and output a collection of kotlin files containing kotlin data classes for that schema? For example, this GraphQL schema:
    myschema.graphql
    type User {
        """
        The unique identifier for the user
        """
        id: String!
        """
        User first and last name
        """
        name: String!
        """
        Gender identity of user
        """
        gender: Gender
    }
    
    enum Gender {
    	MALE
    	FEMALE
    	OTHER
    	UNKNOWN
    }
    ...would generate:
    User.kt
    data class User(
        val id: String,
        val name: String, 
        val gender: Gender
    )
    Gender.kt
    enum class Gender {
        MALE, FEMALE, OTHER, UNKNOWN;
    }
    b
    m
    +2
    • 5
    • 27
  • v

    vio

    03/16/2022, 8:25 PM
    hi all! does
    graphql-kotlin-server
    support scalar definitions for kotlin
    value classes
    ?
    d
    • 2
    • 8
  • t

    tim

    04/12/2022, 4:06 PM
    Hello i’m encountering an error when running
    graphqlIntrospectSchema
    in the 6.0.0-alpha.0 version. I’ve started my gql server and then i’m running
    ./gradlew graphqlIntrospectSchema --endpoint="<http://localhost:12017/api/public/graphql>"<http://localhost:12017/api/public/graphql>
    but this is failing with the following exception:
    Execution failed for task ':graphqlIntrospectSchema'.
    > There was a failure while executing work items
       > A failure occurred while executing com.expediagroup.graphql.plugin.gradle.actions.IntrospectSchemaAction
          > Unable to run introspection query against the specified endpoint=<http://localhost:12017/api/public/graphql>
    No transformation found: class io.ktor.utils.io.ByteBufferChannel -> class kotlin.collections.Map
    with response from <http://localhost:12017/api/public/graphql>:
    status: 200 OK
    response headers: 
    Vary: Origin
    , Content-Length: 34557
    , Content-Type: text/plain; charset=UTF-8
    , Connection: keep-alive
    Any suggestions on what I’m doing wrong?
    d
    v
    • 3
    • 8
  • m

    Martin Brehovsky

    04/13/2022, 2:01 AM
    Hey guys, a quick suggestion / question - would it be possible to introduce
    GraphQLDeprecated
    annotation which would also allow defining deprecated parts of the schema? In our system we use all warnings as errors compiler setting and deprecation requires us to suppress this warning all the time (this itself is another Kotlin issue). However if we would be able to use
    GraphQLDepreacted
    in the same way as regular
    Deprecated
    it would allow us to separate the GraphQL schema deprecation from the actual code deprecation - they are in fact two different concerns. WDYT?
    s
    d
    • 3
    • 3
  • a

    Anshul Sharma

    04/14/2022, 6:36 PM
    Hey guys! Need some help. I am trying to implement a customised directive implementation where I want to hide/unhide a certain field in the return object based on the internal authorization decision. Eg:
    directive @authz_decision on FIELD_DEFINITION
    
    type Query {
      getEmployee(id: ID): Employee
    }
    
    type Employee {
      id: ID!
      displayName: String! @authz_decision
      age: Integer 
      gender: String 
    }
    In this case - I want to write a customised directive where I will compute authorization for a field (internal authorization system) and based on the outcome, I can send back the field in the response or remove the field. I looked at this link - https://opensource.expediagroup.com/graphql-kotlin/docs/schema-generator/customizing-schemas/directives/ And figured a way to inject directives into the configuration - but they don’t seem to be invoked at the runtime (at the query), instead, they get executed at the server startup. Request help & advice! Thanks!
    d
    • 2
    • 3
  • r

    rudolf.hladik

    04/20/2022, 2:46 PM
    Hello there, is there some example using ktor and graphql-kotlin and subscriptions?
    d
    j
    • 3
    • 6
  • s

    Saharath Kleips

    04/26/2022, 8:30 PM
    Hey ya’ll I have a question related to setting up Federation (extensions?) that I could use some direction on. We have two entities that look like this: •
    Box
    ◦ id ◦ size ◦ … ◦ shape ids •
    Shape
    ◦ id ◦ type ◦ …
    Box
    and
    Shape
    are served by two independent services. Can we (or does it make sense to) have
    Shape
    “extend”
    Box
    to “fully resolve” shapes for a given box?
    d
    s
    • 3
    • 8
  • c

    Chris Black

    04/28/2022, 1:22 AM
    HI all, I'm working on updating a code base to Ktor 2.0. This also would require me to update to
    graphql-kotlin-ktor-client:6.0.0-alpha.2
    . Our GraphQL client has a small footprint. I've done some quick testing and it appears to be working well. Are there any known stop-ship bugs I should be aware of? I know the alpha tag sounds pretty dangerous, is this a bad idea?
    d
    • 2
    • 4
  • d

    Dominik Schmidt

    05/10/2022, 10:53 PM
    Hey folks, we're writing some integration tests that require a different schema from the main schema. We have defined this new schema in a different package
    package.testschema
    as opposed to the package where the normal schema is defined
    package.schema
    and overwrite the
    graphql.packages
    property in the tests to look in only
    package.testschema
    . This however causes the following error
    Caused by: com.expediagroup.graphql.generator.exceptions.TypeNotSupportedException: Cannot convert package.schema.foo since it is not a valid GraphQL type or outside the supported packages "[package.testschema]"
    . Any ideas what we can do about this?
    d
    s
    • 3
    • 5
  • r

    Robert

    05/20/2022, 7:58 AM
    Does graphlq-kotlin work with spring 2.7.0? I’m using 5.4.1 https://github.com/rowi1de/graphql-reactive/runs/6516519218?check_suite_focus=true#step:5:66
    Caused by: java.lang.ClassCastException at SchemaPrinter.java:762
    d
    s
    • 3
    • 18
  • m

    Martin Brehovsky

    06/11/2022, 12:50 AM
    Hey guys - we are thinking about reorganization of our spring boot project from a single gradle module to multiple modules where the most of the modules will not depend on each other - only on a "common" module which contains most of the common functionality. However we are facing a complication with our graphql classes. Some of the GraphQL entities should be split into multiple modules - data for one part of the entity will be fetched from one module and for the other part from another module. An obvious solution to this would be federation, however we do not want to run federated gateway (yet) - the whole project will be still run as a monolithic system for the time being. So I'm wondering if there is any mechanism which would allow us to source code federation for organizational purposes, but still keep the schema as a monolith. Thinking about something as following:
    module1/src/domain1/Entity.kt:
    class Entity {
        fun fieldFromDomain1() = Domain1Component.fetchField()
    }
    
    module2/src/domain2/Entity.kt:
    class Entity {
        fun fieldFromDomain2() = Domain2Component.fetchField()
    }
    The result would be the following type in the schema:
    type Entity {
        fieldFromDomain1: String!
        fieldFromDomain2: String!
    }
    Is something like this doable? Or is federation the only option we have?
    d
    • 2
    • 14
  • d

    Daniel Skogquist Åborg

    06/11/2022, 1:12 PM
    Hi, it appears GraphQL-Kotlin 5.5.0 does not allow me to update the minor version of graphql-java from 17.2 to 17.3 (which is a bugfix release!). Can this be fixed? (I've read the reasoning and agree but minor releases should be allowed, no?)
    d
    s
    • 3
    • 3
  • m

    Marco Pierucci

    06/18/2022, 10:22 PM
    Hello hello! Im trying to build a super simple ktor based graphql server to run some android UI tests ( replacing kgraphql) Im following this simpel example https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/server/ktor-server/src/main/kotlin/com/expediagroup/graphql/examples/server/ktor But I keep getting InvalidPackages exception ” The configured packages do not contain any valid classes..” Ive triple checked the package name. Is there anyhting super obvious that Im missing? Cheers!
    d
    • 2
    • 14
  • j

    jmfayard

    06/20/2022, 2:20 PM
    Hello friends In my
    schema.graphql
    , I have 13 queries and 6 mutations. graphql-kotlin takes about 3s to generate the
    GraphQL
    object. I don't mind on server startup, but it makes the unit tests slow. Is there something I can do to investigate & improve performance?
    d
    • 2
    • 17
  • l

    lionel

    06/28/2022, 9:54 AM
    Hello @Dariusz Kuc this is lionel (from egencia) SchemaPrinter is complaining about the the includeDirectivesFilter because there is apparently a types mistake in the predicate https://github.com/ExpediaGroup/graphql-kotlin/blob/5.5.0/generator/graphql-kotlin[…]p/graphql/generator/federation/FederatedSchemaGeneratorHooks.kt You have fixed it 8 days ago, but I am wondering if you consider bumping a 5.6.0 soon ?
    d
    • 2
    • 5
  • l

    lionel

    06/28/2022, 9:55 AM
    thanks for the awesome maintenance work @Dariusz Kuc (where has @Guillaume Scheibel gone by the way ?)
    g
    • 2
    • 3
  • j

    jmfayard

    07/20/2022, 1:43 PM
    Is there a way to add automatic validation to all parameters? Like there is no place where I would welcome to receive an input like
    <script>alert('got you, LOL')</script>
    a
    d
    • 3
    • 9
  • q

    Quanta

    07/21/2022, 5:45 PM
    Does the library provide any built-in mechanism for handling rate limits? If not, what is the recommended way to handle it?
    d
    s
    • 3
    • 4
  • d

    Dariusz Kuc

    07/27/2022, 9:37 PM
    graphql-kotlin
    v6.0.0 is out! 🎉 https://github.com/ExpediaGroup/graphql-kotlin/releases/tag/6.0.0
  • a

    Andrey Tabakov

    07/28/2022, 3:32 PM
    Hi all, is there a way to use kotlinx.serialization as contentConverter? As far as I know, GraphQLRequest serializer relies entirely on jackson, any workarounds?
    d
    • 2
    • 1
  • j

    Joe

    07/28/2022, 11:12 PM
    I've been looking to remove some of our old custom glue code and using more of the graphql-kotlin-server provided infrastructure. ran into some questions about
    KotlinDataLoaderRegistryFactory
    and `GraphQLContext`: • Our dataloaders sometimes need access to things in the
    GraphQLContext
    , which we've dealt with by setting the
    GraphQLContext
    as the
    BatchLoaderContextProvider
    , and then accessing within a dataloader by doing
    environment.getContext<GraphQLContext>()
    • It seems like in order to do the same thing, we'd need to make the
    GraphQLContext
    accessible to each
    KotlinDataLoader
    that we construct and create the
    BatchLoaderContextProvider
    option when using DataLoaderFactory.newDataLoader() • That's all doable, but seems a little awkward (leads us down a FactoryFactory / FactoryProvider type route which always seems a little too JEE-ish) -- would it make sense to have a way for the RegistryFactory to handle DataloaderOptions directly instead ? or is there another way to expose the
    GraphQLContext
    to the `KotlinDataLoader`s that I'm missing?
    d
    s
    • 3
    • 10
  • j

    jmfayard

    07/28/2022, 3:27 PM
    A modest proposal https://github.com/ExpediaGroup/graphql-kotlin/issues/1492
    s
    • 2
    • 1
  • j

    Joe

    08/04/2022, 3:49 PM
    Hey, another question on
    GraphQLContext
    . We currently allow a resolver to set a cookie on the context which we communicate back to the client. Because of the way graphql-java's `ExecutionInput` works though, the cookie gets set on
    input.graphQLContext
    , but not on the
    graphQLContextMap
    that we set on the created
    ExecutionInput
    . In trying to move to using
    GraphQLRequestHandler
    we're missing the ability to access the context after executing the request (or batch request). Some options I can think of: • add a public method to
    GraphQLRequestHandler
    that takes an
    ExecutionInput
    instead of a
    GraphQLServerRequest
    and context • add a getter for the context to `GraphQLServerResponse`/`GraphQLRepsonse` (but
    @JsonIgnore
    it to hide it from the serialized json) • do some stuff in an
    Instrumentation
    to move the cookie from context into
    extensions
    but then do some kind of post processing to remove the cookie extension from the response before serializing it to the client (don't love this one) • don't leverage
    GraphQLRequestHandler
    and continue to execute queries via a
    GraphQL
    object ourselves (would prefer to be able to leverage eg. the batch functionality without reimplementing ourselves) Thoughts on these options? Other ways you can think of to enable this sort of functionality? I'm happy to put together another PR once we agree on direction.
    s
    d
    • 3
    • 7
  • f

    Filip Lastic

    08/10/2022, 4:07 PM
    Hello. I have a question why you don't test jackson serialization of Defined boolean input? see this test https://github.com/ExpediaGroup/graphql-kotlin/blob/master/clients/graphql-kotlin-[…]up/graphql/client/jackson/GraphQLClientJacksonSerializerTest.kt I found this issue in my project, when trying to use
    Defined(true)
    optional input. This value is skipped in serialization and generated json does not contain my boolean value. I created a draft branch there: https://github.com/ExpediaGroup/graphql-kotlin/pull/1513/files
    d
    • 2
    • 8
  • s

    Slackbot

    08/10/2022, 4:54 PM
    This message was deleted.
    y
    j
    • 3
    • 3
  • r

    rocketraman

    08/14/2022, 4:11 PM
    I use graphql-kotlin on top of Ktor. I have a situation in which I get occasional random and not easily reproducible network errors (
    IOException: Broken pipe
    ) from my db driver. While I continue to investigate the root cause of this, I'd like to add a workaround with some retry logic. Since the underlying exception could occur pretty much anywhere, I'm thinking having the logic at the graphql-kotlin layer makes sense, if it is possible. What would the right way to do this? Would an interceptor work for this case?
    d
    a
    • 3
    • 4
Powered by Linen
Title
r

rocketraman

08/14/2022, 4:11 PM
I use graphql-kotlin on top of Ktor. I have a situation in which I get occasional random and not easily reproducible network errors (
IOException: Broken pipe
) from my db driver. While I continue to investigate the root cause of this, I'd like to add a workaround with some retry logic. Since the underlying exception could occur pretty much anywhere, I'm thinking having the logic at the graphql-kotlin layer makes sense, if it is possible. What would the right way to do this? Would an interceptor work for this case?
In some cases, the error happens at the field level, and the
defaultDataFetcherExceptionHandler
is invoked for the entire message. Would be nice to be able to retry the fetch for just the field that failed, but I'd settle for retrying the entire thing.
d

Dariusz Kuc

08/14/2022, 11:01 PM
GraphQL engine is unaware of your fetch logic (you can pull the data from whatever sources) so I personally wouldn't try to modify graphql layer. IMHO you should retry your DB calls instead.
r

rocketraman

08/15/2022, 12:42 AM
Yeah that's what I ended up doing. Thanks!
a

Arnab

08/16/2022, 11:01 AM
You can wrap your fetching with something like https://stackoverflow.com/a/46890009
View count: 9