https://kotlinlang.org logo
Join SlackCommunities
Powered by
# graphql
  • d

    Dariusz Kuc

    11/27/2019, 2:39 PM
    Hello! We just published a second story in a series that highlights different parts of 
    graphql-kotlin
     library. Post today highlights how 
    graphql-kotlin-federation
     can be used to generate Federated GraphQL schemas directly from your source code - https://medium.com/expedia-group-tech/apollo-federation-in-a-graphql-kotlin-server-115cea51607a Stay tuned for the next post in the series that will highlight spring server module!
  • d

    Dariusz Kuc

    12/03/2019, 2:30 PM
    Hello! We just published a third story in a series that highlights different parts of
    graphql-kotlin
    library. Post today highlights how easy it is to create reactive GraphQL web applications in Kotlin using
    graphql-kotlin-spring-server
    -> https://medium.com/expedia-group-tech/creating-a-reactive-graphql-server-with-spring-boot-and-kotlin-54aca7316470 We will be presenting
    graphql-kotlin
    this Thursday @kotlinconf (4:15 GMT+1). You can sign up for the streams at https://kotlinconf.com/
    ⏸️ 1
    ❤️ 3
  • a

    Andy Marwood

    02/12/2020, 4:28 PM
    Hi all! I don’t suppose anyone in here is using amex nodes library for talking to a GraphQL server? https://github.com/americanexpress/nodes If there is I don’t suppose you have managed to get
    @GraphQLVariables
    working with a different name to the argument you are assigning it to? For example (sorry if the syntax isn’t quite perfect):
    query($dateFormat: String) { user(format: $dateFormat) { } }
  • m

    Matthew Browning

    03/19/2020, 3:52 PM
    Hello everyone, anyone successfully get Apollo Uploads working with graphql-kotlin & ktor? If so what did you end up needing to do?
    d
    • 2
    • 5
  • a

    Andrew

    03/29/2020, 4:50 PM
    Using com.apollographql.apollo is it normal to have a large chain of nullable values in the response? Assuming the query is valid it seems like many of the generated values should be nonnull.
    m
    • 2
    • 4
  • p

    Paul O'Donoghue

    04/01/2020, 3:44 PM
    Hi everyone, I searched and could not see anything. I'm wondering what strategies are used to secure a spring application? I currently use auth0 for my user management and have setup JWT authentication to secure my application. I would like to use my tokens permission and user data to perform additional checks and filters on my results, but I can't get past the Anonymous authentication which scrubs all that info by the time I get to my queries.
    j
    • 2
    • 2
  • g

    Gerard Klijs

    04/02/2020, 9:58 AM
    In a little more than 24 hours I will stream GraphQL Subscriptions through the looking glass - A reflection on GraphQL Subscriptions and four server implementations on the JVM on YouTube,

    https://www.youtube.com/watch?v=QRBgKWSqJog▾

    (despite the description in Dutch it will be in English).
    j
    • 2
    • 2
  • s

    Shane Myrick

    04/14/2020, 4:32 PM
    https://medium.com/expedia-group-tech/graphql-kotlin-2-0-4006ea41f774
    👍 2
    🎉 2
  • j

    Joe

    04/17/2020, 10:59 PM
    How are people generally handling getting a list of Parent objects that can contain nested children (eg adding a
    allUsers()
    query to the nested fields documentation page schema, and having a client request
    allUsers() {photos(1)}
    to get the first photo for each user)? Exposing the nested children as a function is really cool from a simplicity of writing code perspective, but ends up executing one fetch per Parent (exposing it as a suspend function at least runs them concurrently). Is looking at the
    DataFetchingEnvironment
    and then performing different fetch logic based on the selectionSet the best way to try to optimize the fetches? Or is there another/better way of thinking about this use case?
    d
    • 2
    • 12
  • t

    tim

    06/09/2020, 6:08 PM
    Hi folks, i'm trying to figure out how DataFetcherResult works when there is an error. Essentially I have something like this:
    Copy code
    fun testQuery(id: Id): DataFetcherResult<String> {
            return DataFetcherResult
                .newResult<String>()
                .error(Failure.App.Unknown)
                .build()
        }
    But bc String is non nullable, I get a 'NullValueInNonNullableField' error when this result is returned to my graphql client. If I put
    .data(null)
    into the builder pattern, then I get an error about String being non nullable and then I get a slightly different error. I assume that if an error occurs, returning null is correct, but I'd prefer to not have nullable return values if I can avoid it?
    d
    s
    • 3
    • 5
  • j

    Joe

    06/11/2020, 11:18 PM
    anyone have good strategies for dealing with GraphQL aliases in queries when introspecting the
    DataFetchingEnvironment.selectionSet
    ? Just ran into https://github.com/graphql-java/graphql-java/issues/1545 and can workaround some cases of it relatively easily, but others less so. We look at the qualifiedName of the leaf fields of the selectionSet to dynamically decide how to build our underlying query. When that leaf field is aliased, we can use
    SelectedField.name
    to go back to the schema name and build the right query to run, but if a parent field is aliased, there doesn't seem to be a way to access the schema-qualified name, only the aliased one?
    • 1
    • 2
  • j

    James Fagan

    06/12/2020, 9:52 AM
    Does anyone know of a way to get syntax highlighting/autocomplete/query validation for GraphQL query strings in Intellij? It's possible for javascript via the JS GraphQL plugin: https://plugins.jetbrains.com/plugin/8097-js-graphql/reviews
    m
    • 2
    • 7
  • j

    Joe

    09/11/2020, 3:37 PM
    Has anyone dealt with structured concurrency issues due to
    FunctionDataFetcher::runSuspendingFunction
    using
    GlobalScope
    instead of an existing scope? Right now, I can put a scope in the context, and in my Query object do something like:
    Copy code
    fun cancellable(env: DataFetchingEnvironment): CompletableFuture<String> {
        return env.getContext<CoroutineScope>().future {
            delay(100)
            "result"
        }
    }
    And then cancel a running query via the context scope's
    .cancel()
    I'd like to be able to do something like:
    Copy code
    suspend fun cancellable(): String {
        delay(100)
        return "result"
    }
    But when I do so, the coroutineContext is not inherited (eg, MDCContext() doesn't place MDC values for logging) and cancelling the parent scope doesn't cancel the created coroutine. I can make it work with a
    FunctionDataFetcher
    subclass that looks for a scope-implementing context and uses that (falling back to GlobalScope if there isn't one). Does that seem like the right approach? Would a PR doing that in
    FunctionDataFetcher
    be welcome?
    d
    • 2
    • 4
  • h

    Hector Gonzalez

    10/01/2020, 2:14 PM
    Hi everyone. I'm trying to do some schema stitching using Apollo Gateway; I am able to consume both remote schemas, I also have definitions for schema extensions and resolvers. Basically, I am trying to retrieve the school "object" for a student, by using the 
    schoolId
    . The catch being that the Student schema and School schema are in separate services. Not sure what I'm missing. I am unable to "join" both types using the resolver. Can you kindly help me out? Here´s the code:
    *const* VCDB_URI = '<http://localhost:4001/graphql>'
    *const* PCDB_URI = '<http://localhost:4002/graphql>'
    //Define schema extensions
    `*const* typeDefs = ``   
    extend type Student {
        
    schoolId: School
      
    }
    ``;`
    *const* resolvers = {
      
    Student: {
          
    schoolId(parent, args, context, info) {
            
    return delegateToSchema({
              
    schema: typeDefs,
              
    operation: 'query',
              
    fieldName: 'getBySchoolId',
              
    args: {
                
    schoolId: parent.id,
              
    },
              
    context,
              
    info,
            
    });
          
    }
      
    }
    }
    //Define the gateway
    *const* gateway = new ApolloGateway({
      
    serviceList: [
        
    { name: 'vcdb', url: VCDB_URI },
        
    { name: 'pcdb', url: PCDB_URI },
      
    ],
      
    extensions: typeDefs,
      
    resolvers: resolvers,
      
    debug: true
    });
    //Define the server
    *const* server = new ApolloServer(
      
    { gateway,
          
    subscriptions: false,
       
    });
    //Start up the server
    server.listen({
      
    port: 4000,
    *}).then(({ url }) =>* {
      `*console.log(
    *:rocket:  *Server ready at ${url}
    );*`
    });
    m
    d
    • 3
    • 40
  • f

    Felix Honer

    01/08/2021, 8:27 PM
    Hi folks, I’m coming from REST and currently thinking about how to handle jwt authentication between webapp (browser) and graphql api server in a good way. ⬇️
    • 1
    • 1
  • s

    Saharath Kleips

    02/03/2021, 9:55 PM
    Sharing since this seems like pretty big news related to graphql https://netflixtechblog.com/open-sourcing-the-netflix-domain-graph-service-framework-graphql-for-spring-boot-92b9dcecda18
    👍 7
  • s

    speed_star

    02/10/2021, 2:42 AM
    Hi. Do you know de facto standard library for GraphQL Client + Kotlin? I found some libraries from official document (https://graphql.org/code/#java-kotlin-client). I'd like to know if there are other libraries. And I’d like to compare multiple libraries.
    d
    s
    +2
    • 5
    • 6
  • d

    dave08

    02/18/2021, 10:26 AM
    Hi! What's the recommended way to deal with filtering by field in a search (like when using a React datatable)? Is there something in graphql-java or graphql-kotlin to simplify/standardize this?
    m
    d
    • 3
    • 22
  • s

    speed_star

    02/25/2021, 1:56 PM
    Hi. I use https://github.com/netflix/dgs-framework/ for client. Client is wrote in Kotlin/Spring Boot. I want to use mock GraphQL server. Should I make object for mock server myself? Or is there any library for mock server wrote in Kotlin/Java?
    d
    h
    • 3
    • 5
  • j

    joshr

    03/06/2021, 4:26 AM
    https://github.com/joshrotenberg/covid19-dgs
    👍 1
    • 1
    • 1
  • a

    andylamax

    04/25/2021, 10:22 AM
    Is there a kotlin multiplatform client implementation? that targets android, ios and js as well?
    m
    • 2
    • 4
  • r

    Rupesh

    05/27/2021, 2:45 AM
    Hi, I wanted to understand how apollo GQL plugin works for android and iOS. Do they share the same codebase for generating the platform specific code? I wanted to build something which generate the code at compile time. Any leads would be appreciated. Is there anyway to achieve the same thing by sharing the common codebase?
    s
    • 2
    • 3
  • s

    Slackbot

    09/13/2021, 3:46 PM
    This message was deleted.
    m
    t
    • 3
    • 4
  • a

    Arnab

    11/26/2021, 11:15 AM
    Is there a guide as to how one can implement cursor-based pagination with GraphQL-Java?
    d
    a
    • 3
    • 3
  • a

    Alexander Suraphel

    01/16/2022, 2:33 PM
    Does graphql server library exist written in Kotlin that supports multiplatform? I want to use it with ktor on ios.
    m
    • 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
    Copy code
    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
    Copy code
    data class User(
        val id: String,
        val name: String, 
        val gender: Gender
    )
    Gender.kt
    Copy code
    enum class Gender {
        MALE, FEMALE, OTHER, UNKNOWN;
    }
    d
    • 2
    • 1
  • t

    tim

    04/12/2022, 4:02 PM
    Moved to graphql-kotlin
    • 1
    • 2
  • m

    Melvin Biamont

    10/10/2023, 3:24 PM
    👋 Hello everyone 2 years ago, I started to work on a Kotlin implementation of a GraphQL server inspired by ApolloGraphQL (because I'm a big fan of it). I know some projects already exist like
    graphql-kotlin
    obviously, but: • when I started,
    graphql-kotlin
    wasn't existing (or at a very early stage if I remember well) • I wanted something lighter, easy to setup and play with For personal reasons, I wasn't able to work on this project, but I finally finished it! 🚀 Allow me to introduce ArianeGraphQL (a clear reference to Apollo 😉). I wrote a Medium post here: https://melvinbiamont.medium.com/lightweight-kotlin-graphql-server-5a26b6cab6d6 Feel free to share your thoughts on Medium or discuss it directly here in 🧵.
    🔥 3
    🎉 1
    graphql 1
    d
    • 2
    • 1
  • m

    martmists

    11/22/2024, 11:29 AM
    I recently wrote a GraphQL Server as part of my Multiplatform-Everything project: https://github.com/Martmists-GH/multiplatform-everything It includes codegen for a client based on a
    graphqls
    schema file, and supports queries, mutations and subscriptions (using the
    graphql-transport-ws
    protocol). If you want to write graphql queries while sticking closely to the syntax with proper checking, you can now just write
    Copy code
    val me = myGraphQLClient.query {
        me {
            name
            id
            fragment on AdminUser {  // for lack of `... on AdminUser`
                capabilities
            }
        }
    }
    println(me.name)
    if (me is AdminUser) {
        println(me.capabilities)
    }
    and it'll return fully typed data 🙂 As for the server, the DSL mostly inspired by KGraphQL with some small improvements where I felt it was necessary, as well as being fully suspending, supporting interface types, arguments and including error paths. Any feedback would be much appreciated!
  • m

    Matthew

    02/01/2025, 4:17 PM
    Hi everyone, I'm Backend developer and new in this community. I want to create a API using graphql and I''ve found a set of libraries that can provide me implement it buuttt idk which of them can be the best
    d
    • 2
    • 3