by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
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
Wesley Schleumer de Góes
@schleumer

Hey! I'm testing 2.0 with Scala 2.13 and i'm facing the following error:

ambiguous reference to overloaded definition,
both method apply in object PossibleObject of type [Ctx, Abstract](objectType: sangria.schema.ObjectType[Ctx, _])sangria.schema.PossibleObject[Ctx,Abstract]
and  method apply in object PossibleObject of type [Ctx, Abstract, Concrete](obj: sangria.schema.ObjectType[Ctx,Concrete])(implicit ev: sangria.schema.PossibleType[Abstract,Concrete])sangria.schema.PossibleObject[Ctx,Abstract]
match argument types (sangria.schema.ObjectType[microsistec.std.transport.generic.graphql.BaseContext,microsistec.sci.notifications.types.InvalidResource]) and expected result type sangria.schema.PossibleObject[_, _]
Error occurred in an application involving default arguments.
          invalidResource.output,

With the following code:

Field(
        name = "resources",
        fieldType = ListType(resourceInterface.Type),
        description = ...,
        possibleTypes = List(
          invalidResource.output,
          propertyResource.output,
          customerResource.output,
          formResource.output
        ),
        resolve = ...

The code itself used to work on 1.4.2 with Scala 2.12, i don't if it's a known bug or anything else

Wesley Schleumer de Góes
@schleumer
I can get over it by using the PossibleObject constructor new PossibleObject(...) but i think it's kinda java-ish
Travis Brown
@travisbrown
@schleumer What you're seeing is because of a change that was necessary to work around a Scala 2.13 bug: scala/bug#11662
IIRC I thought the fix would support the same usage as 1.4.
If you have a complete minimisation I'd be happy to take a look.
Wesley Schleumer de Góes
@schleumer
I think i found the root of the problem whilst i was making the minimisation, the issue looks to be related with the Ctx infer, when i use Unit as Ctx everything works good, buuuuut, when i use a custom Ctx everything just blow, i will make two examples with that information, soon i will send it here
Wesley Schleumer de Góes
@schleumer
hallizh
@hallizh
Has there been any work done regarding implementing the federation spec in sangria?
https://www.apollographql.com/docs/apollo-server/federation/federation-spec/
Kyle H
@khoberg
Any way I can get sangria-graphql-org/sangria#36 merged and possibly published?
Yann Simon
@yanns
@khoberg thx for the reminder. It's merged now.
I was waiting for https://github.com/sangria-graphql-org/sangria/pull/10#issuecomment-572471642 for a new release. @kirach any progress of this?
Hamza EL KAROUI
@helkaroui

Hello, I'm working on a Many-to-Many relation with Sangria and Slick.
I have 3 objects: Role, Permission and RolePermission (a mapping table)

case class Role(id: Long, name: String)
case class Permission(id: Long, name: String)
case class RolePermission(id: Long, roleId: Long, permissionId: Long)

So far, I figured out how to define the relation:

val permissionsByRoleId = Relation[Permission, (RolePermission, Permission), Long]("permissionsByRoleId", tmp ⇒ Seq(tmp._1.roleId), _._2)

but still working on the fetcher and how to add the right field to Role Schema, so that I could retrieve the Role's permissions passing by the intermediate table.

Any help ?
a simple example would help.

Hamza EL KAROUI
@helkaroui
A good person send me this step-per-step guide, on how to write many-to-many relations, I'll leave the link here:
https://scalac.io/akka-http-sangria-graphql-backend/#implementing-many-to-many-relation
Wesley Schleumer de Góes
@schleumer
Alexander Kruzhkov
@YOxan
Hello guys! I've been looking for any news about ability of replacement scala's Future with IO (cats-effect) or smth else (maybe ZIO), but haven't found any info yet. Is there any plan on that?
Mariusz Nosiński
@marioosh
@schleumer AFAIR I did, do you have any issues?
Wesley Schleumer de Góes
@schleumer
@marioosh no issues at all, do you have any code on github? I'm implementing it, but i'm not confident at all :sweat_smile:
Wesley Schleumer de Góes
@schleumer
i'll make an apollo server with nodejs then i will replicate its behaviours on akka-http, i'm still confused with some messages and how its handled/sent
Ghost
@ghost~5563dbb315522ed4b3e0ef4e
Is there any function that can convert sangria Document (the result of graphql macro) into a JSON?
I've tried QueryRenderer.render(graphqlMacro, QueryRenderer.Compact) but it doesn't generate a query like it comes from a client. I'm trying to run an integration test
Wesley Schleumer de Góes
@schleumer
@jama707, do Document.source helps you?
Wesley Schleumer de Góes
@schleumer
image.png
Asaf Ary
@asafary
Question regarding profiling of queries:
We want to add an "explain" query which will provide insight on the internal federation logic to the client
This is very useful for profiling and optimizing a query (similar to SQL)
Because of the distributed nature of the query it doesn't follow the same schema as what is being returned by the "data" field and it doesn't match the "errors" field. Those are the only 2 fields in the official GraphQL spec...
Did anyone implement an extension to the schema for additional metadata in the response? What would be the best way to do that in Sangria?
Wesley Schleumer de Góes
@schleumer
@asafary you could follow the middleware pattern, i don't know how exactly implement what you ask, but you can use this as template: https://gist.github.com/schleumer/b6340b3c3c997ddff427689e3177eaa3 it's the Apollo Tracing implementation on Sangria
Mariusz Nosiński
@marioosh

@asafary add sangria-slowlog to the dependencies libraryDependencies += "org.sangria-graphql" %% "sangria-slowlog" % "0.1.8" and attach the provided middleware extension to the executor

Executor.execute(schema, query,
  middleware = SlowLog(logger, threshold = 10 seconds) :: Nil)

It will respond with some kind of profiliing info.. I hope it helps, if not, it's a good base to make your own profiler which will cover your needs... :)

Asaf Ary
@asafary
@schleumer thanks for the example, I wasn't aware of the MiddlewareExtention option
Kyle H
@khoberg
@yanns, are you still waiting on @kirach before publishing a new version?
Yann Simon
@yanns
@khoberg He does not seem to have time for this right now. Here is the new version: https://github.com/sangria-graphql-org/sangria/releases/tag/v2.0.0-M4