Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
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
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?