Git Product home page Git Product logo

drunk's People

Contributors

facundo-viale-olx avatar jarlakxen avatar nicolasrouquette avatar nightscape avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

drunk's Issues

Getting Size Limit Error on client side

EntityStreamSizeExceptio: actual entity size (Some(19815485)) exceeded content length limit (8388608 bytes)?
It says to configure 'akka.htttp[server|cleint].parsing.max-content-length' or calling 'HttpEntity.withZiseLimit'

Can you help how to provide above options ?
client call:: GraphQLClient(url, ConnectionsOptions.Default,ClientOptions.Default,authHeader)

Use STTP instead of Akka as the backend

The current implementation locks us into using the the AkkaBackend. A more flexible approach would be to swap it out to use STTP which has its own backend concept (one of which is Akka). For our purposes we needed such a capability so I created a spike here leadiq#1 . If the maintainers like the approach I can also open the PR to this repo so it makes it back to the mainline.

Client implementation errror "Cannot deduce decoder"

Hi,

i implemented this client:

package com.github.jarlakxen.drunk
import com.github.jarlakxen.drunk.GraphQLClient.GraphQLResponse
import org.scalatest.FlatSpec
import com.github.jarlakxen.drunk.circe.deriveByTypenameDecoder
import com.typesafe.scalalogging.LazyLogging
import de.salt.d4s.model.entities.{Delivery, DeliveryItem}
import io.circe._
import io.circe.generic.semiauto._
import sangria.macros._
import java.util.concurrent.TimeUnit.MILLISECONDS

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext, Future, duration}


class GraphQLSoDelClientSpec extends FlatSpec with LazyLogging {

  implicit val deliveryDecoder: Decoder[Delivery] = deriveDecoder
  implicit val deliveryItemDecoder: Decoder[DeliveryItem] = deriveDecoder
  val duration = Duration(4000, MILLISECONDS)

  //case class DeliveryQuery(delivery: Delivery)
  type DeliveryQuery = Map[String, List[Delivery]]
  case class Pagination(offset: Int, size: Int)

  implicit val deliveryQueryDecoder: Decoder[DeliveryQuery] = deriveByTypenameDecoder()

  implicit val pagniationEncoder: Encoder[Pagination] = deriveEncoder
  val client = GraphQLClient(s"http://delivery-generator-mho.d4s.salt-solutions.de/graphql")
  implicit val ec = ExecutionContext.global

  "server" should "respond correctly to deliveryQuery" in {

    val query =
      graphql"""
               query{delivery( id: "4727")
               {
               docid
               docType
               system
               status
               items{itemid product quantity unit date}}
               }
    """

    val page1: GraphQLCursor[DeliveryQuery, Pagination] = client.query(query, Pagination(0, 10))
    val data: Future[GraphQLResponse[DeliveryQuery]] = page1.result

    val result = Await.result(data, duration)

    logger.debug(result.toString)
  }
}

Running i get this error:

Cannot deduce decoder. Missing __typename: DownField(data)
DecodingFailure(Cannot deduce decoder. Missing __typename, List(DownField(data)))

Can anyone help me to fix it?

String interpolation is not supported for graphql / gql macro at the moment

I am trying to use drunk for the client to make user selected requests, where vars will vary depending on what the user has selected.

Since String interpolation isn't supported yet, I tried following how variables are defined in the readme, but now I'm getting compilation error: not found: value fams.

Here's what I'm attempting to do. ``:

families = List("ABC", "XYZ")

val query =
    graphql"""
      query getPeople{
        getPeople(families: [$fams]) {
          name
        }
      }
    """
val vars = Map("fams" -> families.mkString("\"", "\",\"", "\"")
val result = client.query[List[People],Map[String,String]](query, vars)

If I skip variable definitions, and just hardcode the families input, I'm still getting an error about a decoder missing:

could not find implicit value for parameter dec: io.circe.Decoder[List[People]]

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.