Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
MrKustra94
@MrKustra94
I don't know what to do with it.
Is that because of the Id?
MrKustra94
@MrKustra94
I've seen that adding Decoder[Id] has solved the issue, but I would rather keep the validation from ScalarAlias. Is there any other way?
Sebastian Bruckner
@Sebruck

@travisbrown

I've just published 9 of Sangria's 18 modules for Scala 2.13, and I think it'd make sense to publish the core module as a 2.0.0-M1 soon (today?): sangria-graphql-org/sangria#1

Awesome ❤️

Travis Brown
@travisbrown
Sebastian Bruckner
@Sebruck
Cool thx! Will update my new library on Monday to cross publish 2.12 and 2.13
Yann Simon
@yanns
Just released https://github.com/sangria-graphql-org/sangria-play-json/releases/tag/v2.0.0 that is also available for scala 2.13.
Yann Simon
@yanns
Travis Brown
@travisbrown
@yanns Great! I'm checking them off here: sangria-graphql/sangria#440
I've opened a PR for sangria-rxscala but RxScala itself doesn't support 2.13 yet, so we're blocked there.
I also started a PR for sangria-slowlog, but there are some significant changes in the OpenTracing API that will require code changes. I'll try to push a WIP branch later today.
Yann Simon
@yanns
Andriy Plokhotnyuk
@plokhotnyuk
ICYMI: json4s is vulnerable under DoS/DoW attacks which exploit hash collision vulnerabilities of Scala's HashMap or parsing vulnerabilities of Java's BigInteger/BigDecimal values
Yann Simon
@yanns
just released https://github.com/sangria-graphql-org/sangria-json4s-native/releases/tag/v1.0.1 that is also available for scala 2.13
Yann Simon
@yanns
Sangria slowlogs is now available for scala 2.13: https://github.com/sangria-graphql-org/sangria-slowlog/releases/tag/v2.0.0-M1
This version introduces breaking changes and is not available for scala 2.11 anymore.
Binh Nguyen
@ngbinh
:clap:
Andrey Tararaksin
@atararaksin

Hey guys, any ideas why wouldn't this work? This is just a minimal test of ScalarAlias (and custom scalars in general):

  case class Foo(s: String)
  case class FooWrapper(foo: Foo)
  implicit val FooType = ScalarAlias[Foo, String](StringType, _.s, s => Right(Foo(s)))
  val FooWrapperInputType = deriveInputObjectType[FooWrapper]()
  val FooWrapperArg = Argument("data", FooWrapperInputType)

  val Query = ObjectType(
    "Query",
    fields[GraphQLContext, Unit](
      Field("testFoo", StringType, arguments = FooWrapperArg::Nil, resolve = c => "ok")
    )
  )

Sending this query

query { testFoo(data: {foo: "test"}) }

results in

{
  "data": null,
  "errors": [
    {
      "message": "Argument 'data' has invalid value: Attempt to decode value on failed cursor: DownField(s),DownField(foo) (line 28, column 17):\n  testFoo(data: {foo: \"test\"})\n                ^",
      "path": [
        "testFoo"
      ],
      "locations": [
        {
          "line": 28,
          "column": 17
        }
      ]
    }
  ]
}
And interestingly, this happens only if I use Foo inside FooWrapper: if the argument contains Foo directly instead of FooWrapper, everything works (the query than would be query { testFoo(data: "test") })
Andrey Tararaksin
@atararaksin
Answer to myself: I need to define a FormInput[FooWrapper] in scope. The one derived automatically by circe-support has no notion of my Foo scalar, so it treats it as a normal case class. So it expects the foo field to be an object with s: String field, hence the error message.
Would be cool though if there still was some way to derive FormInput for such cases automatically.
Erik
@ErikHedblom

Hello, I'm debugging this sangria-graphql/sangria#465 where sangria fails to resolve SequenceLeafAction. I'm having a hard time understanding how the resolveActionsPar function works.

I'm especially interested in the purpose of resolveDctx. Is there any documentation regarding this or any one who might be able to help me with this?

Miguel Carmona
@mkarmona
I am trying to use my controller programatically internally in the same API so I need ot provide a Document. Is there a simple way of creatring documents from the schema query definition and pass the arguments the funcion needs? thanks in advance
Miguel Carmona
@mkarmona
well, does anyone know if there is an easy way of filling this just passing the arguments the query needs?
val docQ = Document(definitions = Vector(
      OperationDefinition(
        operationType=OperationType.Query,
        name=Some(qName),
        selections=GQLSchema.query.fieldsByName("drug")
      ))
    )
fieldsByName gives me the query I would like to execute but how to extract it and pass the proper arguments the object needs ?
Patrick Skjennum
@Habitats

I'm using sangria with circe, and bundling the serialization boilerplate in the companion object like so:

case class Foo(bar: Int)
object Foo {
  implicit val Type: ObjectType[GraphQLContext, Foo] = deriveObjectType[GraphQLContext, Foo]()
  implicit val InputType: InputObjectType[Foo]       = deriveInputObjectType[Foo]()
  implicit val Dec: Decoder[Foo]                     = deriveDecoder[Foo]
}

is it possible in any way to store this boilerplate in a superclass such that I can just extend Foo and get the extra stuff automatically?

I figured it might be possible with classTags (to get around type erasure) but no avail:

case class Foo(bar: Int) extends Bar[Foo]
class Bar[T : ClassTag] ()
object Bar {
  implicit val Type: ObjectType[GraphQLContext, T] = deriveObjectType[GraphQLContext, T]()
  implicit val InputType: InputObjectType[T]       = deriveInputObjectType[T]()
  implicit val Dec: Decoder[T]                     = deriveDecoder[T]
}
sinanspd
@sinanspd
Hey guys,
What is the best way to resolve a query into a external http call to a Rest api?
Yann Simon
@yanns
Hi community, I'd need some help to open and review pull requests on the temporary organization: https://github.com/sangria-graphql-org. For example, for each project, we'd need one PR to update sbt-coverage and the scala 2.13 version at the same time.
Sebastian Bruckner
@Sebruck

Cheers!

Could anyone PTAL at my PR? sangria-graphql-org/sangria-relay#10

Would it be possible to get a hotfix release for this? It is a blocker for us to go live.

Thx a lot!!! ❤️

Yann Simon
@yanns
Hi, I'd the view of the community about the PR "Support for repeatable directives":
sangria-graphql-org/sangria#5
I don't have the knowledge to decide if it should be merged, completely or partially.
If anyone could give any opinions here...
After that, I think we can have a v2.0.0-M2 release.
There's in the pipe an exciting feature allowing better performances: sangria-graphql-org/sangria#12
Sebastian Bruckner
@Sebruck

https://twitter.com/sebbruck/status/1203679967944626176

Thanks to everyone who helps to continue this project!

Binh Nguyen
@ngbinh
@yanns I saw 2.0.0-M2 tag on Github but no artifact on Maven yet. Is it intentional?
Binh Nguyen
@ngbinh
I see, thanks for the update. I will try to see if there's a way to migrate the build to sbt-ci-releasehttps://github.com/olafurpg/sbt-ci-release
Yann Simon
@yanns
Travis just fixed the issue
Yann Simon
@yanns
Please be aware that we might have an issue in the 2.0.0-M2 release: https://github.com/sangria-graphql-org/sangria/pull/10#issuecomment-571471876
Yann Simon
@yanns
I release the 2.0.0-M3 version that reverts the change causing the issue in 2.0.0-M2: https://github.com/sangria-graphql-org/sangria/releases/tag/v2.0.0-M3
Ellen Shapiro
@designatednerd
Hi! I was wondering if there's a new place that this got deployed: http://toolbox.sangria-graphql.org/ - looks like that Heroku account got deleted.
Darshak Mehta
@darshakmehta
@yanns Did you find any answer for deprecationReason for InputField?
rohitgupta328238
@rohitgupta328238
hi
Anton
@antonkatz
Question: what is the accepted way to automatically test endpoints/resolvers?
Yann Simon
@yanns
@darshakmehta sorry, I don't get the context? If it's possible to deprecate an input field maybe?
Miguel Carmona
@mkarmona
hi! can anyone shade some light on it?
Option[Seq[Product with Serializable]] is invalid type for the resulting GraphQL type Option[Seq[Option[Any]]]
It works when I just return an UnionType and there is a deferOpt inside like this OptionType(msearchResultType)
lazy val msearchResultType = UnionType("MSearchResultType", types = List(targetImp, drugImp, diseaseImp))
but the problem shows when I need to resolve a list of them as OptionType(ListType(OptionType(msearchResultType)))
Miguel Carmona
@mkarmona
did anyone face that problem before when resolving a list of UnionType elements? any code I could try? The example here works because there is no any fetcher implicated https://github.com/sangria-graphql/sangria/blob/270af67f3ab457885638ff74bb184940385efee7/src/test/scala/sangria/execution/UnionInterfaceSpec.scala#L36
and then glueing all this together
Field("combined", OptionType(ListType(OptionType(msearchResultType))),
        description = Some("Return combined"),
        resolve = ctx => {
          Some(ctx.value.combined.map(el => {
            el.entity match {
              case "target" => targetsFetcher.deferOpt(el.id)
              case "disease" => diseasesFetcher.deferOpt(el.id)
              case "drug" => drugsFetcher.deferOpt(el.id)
              case _ => None
            }
          }))
        }),
Miguel Carmona
@mkarmona
it apparently works if I return a wrapper object and put the defer match inside so it won't be mapping a list to defer but each object independently
Kyle H
@khoberg
I created a pull request sangria-graphql/sangria#472, but it looks like the travis-ci build failed. It doesn't look like it has anything to do with my change specifically, and a bunch of builds have failed with the same (some sort of failure to install JDK8 on the travis machine). Is there a way to fix this/re-run the build?
Yann Simon
@yanns
@khoberg Please use https://github.com/sangria-graphql-org for the moment