NoClassDefFoundError: sangria/parser/DeliveryScheme
https://gist.github.com/jgillich/3e8d90dde7526d47a5f5fe496aae9889can someone help me with the mutation?
Schema
implicit val inComercioType = deriveObjectType[DataRepo, comercio]()
val ComercioInObject = {
InputObjectType(
name = "Insert Comercio",
description = "",
List(
InputField(
name = "condicion",
fieldType = StringType),
InputField(
name = "laltitud",
fieldType = BigDecimalType),
InputField(
name = "longitud",
fieldType = BigDecimalType),
InputField(
name = "distancia",
fieldType = IntType),
)
)
}
val Condicion: Argument[String] = Argument("condicion", StringType)
val Latitud: Argument[BigDecimal] = Argument("latitud", BigDecimalType)
val Longitud: Argument[BigDecimal] = Argument("longitud", BigDecimalType)
val Distancia: Argument[Int] = Argument("distancia", IntType)
val MutationType =
ObjectType(
"Mutation",
fields[DataRepo, Unit](
Field(
name ="addComercios",
fieldType = ComercioOutObject,
arguments = Condicion :: Latitud :: Longitud :: Distancia :: Nil,
resolve = c => c.ctx.gqlAddComercios(c.arg(Condicion),c.arg(Latitud) ,c.arg(Longitud),c.arg(Distancia))
),
)
)
val SchemaDefinition: Schema[DataRepo, Unit] = Schema(QueryType,Some(MutationType))
Datarepo
def gqlAddComercios(condicion: String,latitud:BigDecimal,longitud:BigDecimal,distancia:Int=250):List[getComercio] = comercio(condicion,latitud,longitud,distancia,token).insertContent
Hello,
I have the following field relation:
Field("setups",
fieldType = ListType(TransportSetup.toGraphType),
arguments = fetchTransportSetupArgs.createGraphTypeArgs,
resolve = ctx => setupFetcher.deferRelSeq(linkSetupByRouteId, ctx.value.getId)
),
I would like to pass the arguments of the field to my fetcher, i tried to make work deferred resolver but no luck so far
ID
. You can define it to what type you need.DeferredValue
and DeferredResolver
.DeferredResolver.fetchersWithFallback
.
As I understand it: if you have n different values from n branches, this method is used to know what to do with those n values.
For example, in the MeasureComplexity
:
def reduceAlternatives(alternatives: Seq[Acc]) = alternatives.max
In TagCollector
, we collect all tags:
def reduceAlternatives(alternatives: Seq[Acc]) = alternatives.toVector.flatten
I've been trying to dig into Sangria Fetchers (Data Loaders) and couldn't quite figure out if they go across requests or if they only act per-request. I found this PR mentioning that the caching is per-request, but haven't found anything to confirm if the batching/data loader part is as well 🤔 sangria-graphql/sangria#447
For example, imagine this scenario:
Would this result in 1 database calls (so, it works across requests) or 2 database calls (it's per-request)?
Field(
"field_name",
arguments = IncludeKeys :: ExcludeKeys :: Limit :: Offset :: SortArg :: Nil,
resolve = ctx => {
val includes = ctx.arg(IncludeKeys)
val excludes = ctx.arg(ExcludeKeys)
val limit = ctx.arg(Limit)
val offset = ctx.arg(Offset)
I'm trying to make a HandledException
and include a custom JSON response. That goes through the additionalFields: Map[String, ResultMarshaller#Node] = Map.empty,
field, which Node
appears to be an interface, perhaps supporting other libraries (ex: io.circe.Json).
Is there a way I can somehow pass Json directly into the HandledException.additionalFields
?
import _root_.sangria.marshalling.circe._
val params = Map[String, ResultMarshaller#Node]("" -> io.circe.Json.obj())
HandledException(
log.traceId,
params,
addFieldsInError = true,
addFieldsInExtensions = false,
)
import _root_.sangria.marshalling.circe._
val json: CirceResultMarshaller.Node = Json.obj(???)
val params: Map[String, ResultMarshaller#Node] = Map[String, ResultMarshaller#Node](
"error" -> json
)
HandledException(
log.traceId,
params,
addFieldsInError = true,
addFieldsInExtensions = false,
)