https://kotlinlang.org logo
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
  • j

    janvladimirmostert

    12/05/2019, 4:06 PM
    Quick question, i want to display a GraphQL Playground for my application, but i'm not using Spring Boot Where do i get the HTML, CSS and JavaScript that will display a GraphQL playground for me? I'm assuming it's just HTML, CSS and JS ?
    d
    • 2
    • 3
  • j

    Jesper Hasselström

    12/07/2019, 11:47 AM
    Hello! We are currently experimenting with migrating our GraphQL app based on Kotlin with graphql-java-tools, to graphql-kotlin. We ran into an issue just now. We have a query that takes
    ids:List<String>?
    as an argument. When creating our schema we get an error:
    Exception in thread "main" com.expediagroup.graphql.exceptions.InvalidInputFieldTypeException: Argument cannot be an interface or a union, parameter #1 ids of fun <X>.query(kotlin.collections.List<kotlin.String>?, kotlin.String?, kotlin.collections.List<kotlin.String>?): kotlin.collections.List<X>
    How can this be solved?
    s
    • 2
    • 5
  • g

    Goregius

    12/28/2019, 6:21 PM
    Are there any plans to use string literals for descriptions instead of comment descriptions since comment descriptions don't get picked up by Apollo Gateway by default?
    d
    • 2
    • 24
  • g

    Goregius

    01/03/2020, 2:44 AM
    I read about there being a client, is this planned to support multiplatform like how ktor does it? Because otherwise wouldn't apollo android with coroutines support be good enough for just jvm kotlin?
    s
    g
    d
    • 4
    • 6
  • d

    Dariusz Kuc

    01/09/2020, 1:30 PM
    hello, i personally would just do a suspendable function, since our functions effectively become the data fetcher in
    graphql-java
    world there is really no need for the data loader, e.g.
    class Employee(val name: String, private val companyId: Int) {
      suspend fun company() = myCompanyService.load(companyId)
    }
    there are number of ways of how to expose the
    myCompanyService
    in the above
    d
    r
    • 3
    • 21
  • b

    bjartek

    01/09/2020, 6:05 PM
    What about handling partial errors? Lets say I have an Employee that has a company and loading one Company fails. I still want data for all the Employees and companies that have data, but an error in the case where it does not load
    d
    • 2
    • 37
  • g

    Goregius

    01/15/2020, 9:43 PM
    I'm just wondering since you're using gradle now, are you going to add kapt annotation processing? Example shown here: https://spring.io/guides/tutorials/spring-boot-kotlin/#_configuration_properties
    s
    d
    • 3
    • 12
  • g

    Goregius

    01/17/2020, 8:37 AM
    graphql-java 14 is out now, is it too late to support it for a 2.0 release?
    d
    s
    • 3
    • 3
  • g

    Goregius

    01/19/2020, 11:54 PM
    Just curious, how have you managed to used this with legacy (such as spring MVC without webflux) servers? I'm assuming you could only do this by using graphql-java or by creating a new server which uses the legacy server as a service
    d
    • 2
    • 5
  • r

    Robert

    02/05/2020, 7:52 PM
    Hey quick question: are subscriptions and custom directives supported?
    s
    • 2
    • 2
  • g

    Goregius

    02/10/2020, 11:40 PM
    hi, when using apollo federation, would using apollo graph manager be recommended for this? It's possible to use it for the gateway but would there be a way registering services shown here: https://www.apollographql.com/docs/graph-manager/federation/#registering-federated-services or is there a more recommended way for a non apollo js server? Because preventing breaking changes would be quite helpful.
    d
    • 2
    • 4
  • s

    sevil

    02/28/2020, 10:50 AM
    Hi, there is a new CVE issue published on 18th of February on io.netty dependencies. I just integrated graphql-kotlin to our backend project and started to get security warnings. More information for CVE https://snyk.io/vuln/SNYK-JAVA-ORGWSO2TRANSPORTHTTP-548944 . Any suggestion is appreciated.
    d
    • 2
    • 3
  • r

    Robert

    04/21/2020, 1:26 PM
    Hey, does `DataLoader`support kotlin coroutines? Using version 2.1.0 Java Example: https://github.com/ExpediaGroup/graphql-kotlin/blob/master/examples/spring/src/main/kotlin/com/expediagroup/graphql/examples/dataloaders/DataLoaderConfiguration.kt
    d
    • 2
    • 22
  • r

    Robert

    04/29/2020, 7:17 AM
    com.expediagroup.graphql.exceptions.TypeNotSupportedException: Cannot convert java.time.LocalDateTime? since it is not a valid GraphQL type or outside the supported packages is there an easy fix for this?
    d
    • 2
    • 6
  • i

    ilaborie

    04/29/2020, 7:41 AM
    You can add a Scalar, https://expediagroup.github.io/graphql-kotlin/docs/writing-schemas/scalars#__docusaurus
    👍 1
    r
    d
    • 3
    • 3
  • d

    Darren

    04/30/2020, 11:00 PM
    Hey all, I was wondering if anyone has any experience implementing query scoped, read only transactions. We have a graphql schema where entities are stored in separate tables in Postgres. On the mutation side, the entities are updated together in a database transaction. We want to ensure that reads are consistent in the same way across a given read query. Right now, we have a race condition where an update can cause a data consistency issue if one data fetcher has read, an update happens, and then a second data fetcher reads. Technically we could start a transaction in Instrumentation and pin a database connection to the query context and have all of the underlying services share this transaction. Seems a little less than ideal and introduces some concurrency concerns since data fetchers can be async. Does anyone have any other suggestions or experiences trying to make transaction guarantees across a query?
    s
    d
    • 3
    • 10
  • l

    Lenny

    05/08/2020, 7:01 PM
    i filed a bug about this before i got access to kotlin slack, but is there a way to use
    @GraphQLID
    to create an argument for a list of ids, like
    foo(ids: [ID!]!)
    ?
    s
    r
    • 3
    • 10
  • t

    tim

    05/13/2020, 11:06 AM
    Hey folks, i'm trying to generate client classes from a schema.graphql file but the generated file is empty? I don't think my setup can get any simplier ... but any suggestions on what I'm doing wrong are appreciated 🙏 schema.graphql
    type Query {
     hello: String
    }
    command:
    gradle graphqlGenerateClient --schemaFileName="src/main/resources/schema.graphq" --packageName="com.example.graphql.generated"
    Oh and im running 3.0.0-RC2
    d
    • 2
    • 73
  • l

    Lenny

    05/13/2020, 10:24 PM
    ack, nevermind … i can’t read. i needed to do this:
    override fun willGenerateGraphQLType(type: KType): GraphQLType? {
        return when (type.classifier as? KClass<*>) {
          // note the ::class.java
          CurrencyCodeProtos.CurrencyCode::class.java -> currencyCodeEnum
          else -> super.willGenerateGraphQLType(type)
        }
      }
    s
    • 2
    • 4
  • l

    Lenny

    05/14/2020, 5:42 PM
    looking through some old threads here, i’m seeing that expediagroup doesn’t use dataloader — do y’all have another solution to the N+1 query problem? i’d be happy to drop dataloader if possible
    s
    k
    • 3
    • 11
  • l

    Lenny

    05/21/2020, 9:28 PM
    i just converted a graphql-java service to kotlin, then rewrote it to use graphql-kotlin. i ran load tests before and after. the final version has a significant performance regression … average latency rose from 200-ish ms to over 1000ms. this is using 3.0.0-rc5. i’ll dig in more but if anyone has guidance on where to look i could use the help!
    s
    d
    • 3
    • 29
  • a

    Aaron

    05/30/2020, 8:13 AM
    Hi everyone, has anyone encounter an issue with
    spring-devtool
    and
    graphql-kotlin-spring-server
    when hot-swapping code? The full detail is here https://github.com/ExpediaGroup/graphql-kotlin/issues/730. Essentially it would work fine the first time around, but after you make some changes or just add a simple
    println
    I get this error
    DataFetchingException: Object is not an instance of declaring class
    . Would love to know if anyone encounter this and know how to fix this 🙂
    d
    s
    r
    • 4
    • 9
  • l

    Lenny

    06/04/2020, 4:18 PM
    just hit a snag though: after i introduced a second operation, i started getting a compilation error because both generated files include
    typealias ID = String
    so i’m getting
    error: redeclaration: ID
    … any ideas?
    d
    • 2
    • 7
  • v

    vio

    06/05/2020, 11:39 AM
    Hi all, I'm new to graphql, and I was wondering what is the best way to implement queries/mutations with restricted access based on user rights? in a restful api we would make endpoints restricted, I'm not sure how to approach this with graphql. I'm using ktor as well and graphql-kotlin. Thank you!
    d
    r
    • 3
    • 12
  • r

    Roy Åne Sylthe

    06/09/2020, 9:30 AM
    Hello everyone! I'm trying to write some custom scalar for LocalDate but I'm currently stuck with an issue I'm having some real trouble solving. I'm sending in some data to my mutator, along with it a date string formatted like "1989-04-24", and I'm met with an exception telling me `Cannot construct instance of
    java.time.LocalDate
    (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)`
    object DateCoercing : Coercing<Date, String> {
    
      override fun parseValue(input: Any?): Date = try {
        LocalDate.parse(serialize(input))
      } catch (e: DateTimeParseException) {
        throw CoercingParseValueException("...", e)
      }
    
      override fun parseLiteral(input: Any?): Date? = try {
        (input as? StringValue)?.value?.let { LocalDate.parse(it) }
      } catch (e: DateTimeParseException) {
        throw CoercingParseLiteralException("...", e)
      }
    
      override fun serialize(dataFetcherResult: Any?): String = dataFetcherResult.toString()
    }
    I've tried most of the common solutions found by Googling to no avail...
    r
    d
    l
    • 4
    • 16
  • n

    neetkee

    06/25/2020, 4:01 PM
    Hello, how do you handle N+1 problem? I know about data loaders, but they have a significant problem - they can’t be chained https://github.com/graphql-java/graphql-java/issues/1078 For example, if I have some field, that relies on two data loaders, it may not work. @Dariusz Kuc I’ve heard you don’t use them, so how do you handle it? Can you provide some code? I think it might be a useful example
    l
    d
    • 3
    • 28
  • r

    Robert

    07/10/2020, 7:53 AM
    Ok true 👍 And I was wrong, ContextWebFilter is for incoming and ExchangeFilterFunction for the outgoing requests via WebClient. However, the Reactor/Security Context (also GRAPHQL_CONTEXT_KEY) is not present there. The requests outside of graphq-kotlin handling have a populated Context. The Problem is also there outside of the FilterFunction. Using:
    val reactorContext =
        coroutineContext[ReactorContext]?.context
    in a resolver function won't return the context
    d
    • 2
    • 6
  • f

    Filip Lastic

    07/17/2020, 9:40 AM
    Hi! Please, it is possible to change name of ENUM while generating graphql schema? In my case, I need to have enum name like this
    name
    (lowercase). Kotlin does not support this naming, because
    Conflicting declarations: enum entry name, public final val name: String
    . So, I want to name it with UPPERCASE and then generate enum names to GraphQL schema as lowercase (example below). I tried to use
    @GraphQLName
    , but it doesn't work with ENUM classes 😞
    enum class ApplicantsUpdateColumn {
        @GraphQLName("id")
        ID,
    
        @GraphQLName("data")
        DATA,
    
        @GraphQLName("name")
        NAME //I want to have this as lowercase "name"
    }
    r
    d
    s
    • 4
    • 9
  • r

    Robert

    07/17/2020, 9:46 AM
    Should it be possible to use
    javax.validation.constraints.Positive
    on a resolver argument? It currently crashes
    @Validated
    class QueryImpl:Query{
      override suspend fun query(id: String, @Positive amount: BigDecimal)
    }
    java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
    at java.base/java.util.Arrays$ArrayList.get(Arrays.java:4351)
    at org.hibernate.validator.internal.metadata.aggregated.ParameterMetaData$Builder.build(ParameterMetaData.java:169)
    at org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData$Builder.findParameterMetaData(ExecutableMetaData.java:435)
    at org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData$Builder.build(ExecutableMetaData.java:388)
    at org.hibernate.validator.internal.metadata.aggregated.BeanMetaDataImpl$BuilderDelegate.build(BeanMetaDataImpl.java:788)
    at org.hibernate.validator.internal.metadata.aggregated.BeanMetaDataImpl$BeanMetaDataBuilder.build(BeanMetaDataImpl.java:648)
    at org.hibernate.validator.internal.metadata.BeanMetaDataManager.createBeanMetaData(BeanMetaDataManager.java:204)
    at org.hibernate.validator.internal.metadata.BeanMetaDataManager.getBeanMetaData(BeanMetaDataManager.java:166)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:265)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:233)
    at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:105)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
    at capital.scalable.agenttoolapi.routes.graphql.schema.payments.mutation.resolver.WealthPaymentCreationMutationResolver$$EnhancerBySpringCGLIB$$fa066940.deposit(<generated>)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97)
    at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:113)
    at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:106)
    at kotlin.reflect.full.KCallables.callSuspend(KCallables.kt:55)
    at com.expediagroup.graphql.execution.FunctionDataFetcher$runSuspendingFunction$1.invokeSuspend(FunctionDataFetcher.kt:128)
    d
    • 2
    • 5
  • d

    Das135

    07/20/2020, 9:05 AM
    Please, is it possible to somehow "hide" any types when generating GraphQL schema? I am using Jetbrains Exposed library to ORM mapping, I have DAO object and entity class (having functions like
    .wrapRow
    etc..
    object TableObject : IdTable<Int>("tableName") {
        val property1 = long("column1")
        val property2 = long("column2")
    }
    
    class MappedEntity(id: EntityID<Int>): Entity<Int>(id){
        companion object : EntityClass<Int, MappedEntity>(TableObject)
    
        var entityProperty1 by TableObject.property1
        var entityProperty2 by TableObject.property2
    }
    I want to return
    MappedEntity
    in GraphQL schema, but there is problem with
    com.expediagroup.graphql.exceptions.TypeNotSupportedException: Cannot convert org.jetbrains.exposed.sql.ResultRow? since it is not a valid GraphQL type or outside the supported packages
    . Do I need to map this entity to another class, or is there way to use MappedEntity class in GraphQL schema?
    d
    r
    • 3
    • 5
Powered by Linen
Title
d

Das135

07/20/2020, 9:05 AM
Please, is it possible to somehow "hide" any types when generating GraphQL schema? I am using Jetbrains Exposed library to ORM mapping, I have DAO object and entity class (having functions like
.wrapRow
etc..
object TableObject : IdTable<Int>("tableName") {
    val property1 = long("column1")
    val property2 = long("column2")
}

class MappedEntity(id: EntityID<Int>): Entity<Int>(id){
    companion object : EntityClass<Int, MappedEntity>(TableObject)

    var entityProperty1 by TableObject.property1
    var entityProperty2 by TableObject.property2
}
I want to return
MappedEntity
in GraphQL schema, but there is problem with
com.expediagroup.graphql.exceptions.TypeNotSupportedException: Cannot convert org.jetbrains.exposed.sql.ResultRow? since it is not a valid GraphQL type or outside the supported packages
. Do I need to map this entity to another class, or is there way to use MappedEntity class in GraphQL schema?
d

Dariusz Kuc

07/20/2020, 1:24 PM
you can exclude types from being present in the schema by annotating them with
@GraphQLIgnore
but that implies they have to be part of your code base
if they are outside your code base (as in your use case above) you can manually process them using schema generator hooks (but that might be somewhat tedious)
I think the simplest workaround is to map them to some data class within your code base
➕ 1
:yes: 1
links: • excluding fields -> https://expediagroup.github.io/graphql-kotlin/docs/schema-generator/customizing-schemas/excluding-fields • hooks -> https://expediagroup.github.io/graphql-kotlin/docs/schema-generator/customizing-schemas/generator-config#schema-generator-hooks
r

Robert

07/24/2020, 12:20 PM
Don't share Entitiy & Graphql Model in the first place, would be an option.
👍 1
View count: 9