Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
ValdemarGr committed Mar 25, 2024
1 parent ff131c3 commit a7897e4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions modules/core/src/main/scala/gql/Validation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ object Validation {
input match {
case InArr(of, _) => validateInput[F, G](of, discovery)
case InOpt(of) => validateInput[F, G](of, discovery)
case t @ Input(name, fields, _) =>
case t @ Input(name, fields, _,_) =>
useInputEdge(t, discovery) {
val validateNonEmptyF =
if (fields.entries.isEmpty) raise(InputNoArgs(name))
Expand All @@ -297,7 +297,7 @@ object Validation {
validateArg[F, G](fields, discovery)
}
case Enum(name, _, _, _) => validateTypeName[F, G](name)
case Scalar(name, _, _, _) => validateTypeName[F, G](name)
case Scalar(name, _, _,_, _) => validateTypeName[F, G](name)
}

def validateArg[F[_], G[_]](arg: Arg[?], discovery: SchemaShape.DiscoveryState[F])(implicit
Expand Down Expand Up @@ -463,7 +463,7 @@ object Validation {
}

sel match {
case Union(_, types, _) =>
case Union(_, types,_, _) =>
val ols = types.toList.map(_.tpe)

allUnique[F, G](DuplicateUnionInstance.apply, ols.map(_.value.name)) >>
Expand All @@ -481,7 +481,7 @@ object Validation {
): G[Unit] =
tl match {
case Enum(_, _, _, _) => G.unit
case Scalar(_, _, _, _) => G.unit
case Scalar(_, _, _, _,_) => G.unit
case s: Selectable[F, ?] => validateToplevel[F, G](s, discovery)
case OutArr(of, _, _) => validateOutput[F, G](of, discovery)
case o: OutOpt[?, ?, ?] => validateOutput[F, G](o.of, discovery)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/gql/dsl/UnionDsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ trait UnionDslFull {
object UnionDsl extends UnionDslFull {
final class PartiallyAppliedUnion[F[_], A](private val name: String) {
def variant[B](pf: PartialFunction[A, B])(implicit innerTpe: => Type[F, B]): Union[F, A] =
Union[F, A](name, NonEmptyList.of(Variant[F, A, B](Eval.later(innerTpe))(pf.lift.andThen(_.rightIor))), None)
Union[F, A](name, NonEmptyList.of(Variant[F, A, B](Eval.later(innerTpe))(pf.lift.andThen(_.rightIor))),Nil, None)

def subtype[B: ClassTag](implicit ev: B <:< A, innerTpe: => Type[F, B]): Union[F, A] =
variant[B] { case a: B => a }(innerTpe)
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/main/scala/gql/preparation/ArgParsing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ class ArgParsing[C](variables: VariableMap[C]) {
)
}
}
case (Scalar(name, _, decoder, _), x: NonVar[List[C]]) =>
case (Scalar(name, _, decoder,_, _), x: NonVar[List[C]]) =>
G.ambientField(name) {
G.raiseEither(decoder(x.map(_ => ())), x.c)
}
case (Input(_, fields, _), V.ObjectValue(xs, cs)) => decodeArg(fields, xs.toMap, ambigiousEnum, cs)
case (Input(_, fields,_, _), V.ObjectValue(xs, cs)) => decodeArg(fields, xs.toMap, ambigiousEnum, cs)
case (a: InArr[a, c], V.ListValue(vs, cs)) =>
vs.zipWithIndex
.parTraverse { case (v, i) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ class DirectiveAlg[F[_], C](
parseProvided[P](directives, context)(pf)
}

def parseSchemaDirective[P[x] <: Position[F, x]](sd: ast.SchemaDirective[F, P], context: List[C]): G[ParsedDirective[?, P]] = {
def parseSchemaDirective[P[x] <: SchemaPosition[F, x]](sd: ast.SchemaDirective[F, P], context: List[C]): G[ParsedDirective[?, P]] = {
// rigid type variable inference help
def go[A](p: P[A]): G[ParsedDirective[A, P]] =
parseArg(p, sd.args.map{ case (k, v) => k -> v.map(_ => List.empty[C])}, context).flatMap{ a =>
G.pure(ParsedDirective(p, a))
}
parseArg(p, sd.args.map{ case (k, v) => k -> v.map(_ => List.empty[C])}, context)
.map(ParsedDirective(p, _))

go(sd.position: P[?]).widen[ParsedDirective[?, P]]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class QueryPreparation[F[_], C](
u.types.toList.map { case x: gql.ast.Variant[F, A, b] =>
Specialization.Union(u, x)
}
case it @ Interface(_, _, _, _) =>
case it @ Interface(_, _, _,_, _) =>
val m: Map[String, SchemaShape.InterfaceImpl[F, A]] =
implementations
.get(it.name)
Expand Down

0 comments on commit a7897e4

Please sign in to comment.