Skip to content

Commit

Permalink
add federation 2.7 and 2.8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpdaniels committed Jun 8, 2024
1 parent c5897bb commit 67a34ac
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/src/main/resources/gateway_v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"keywords": [],
"license": "MIT",
"dependencies": {
"@apollo/server": "4.9.5",
"@apollo/gateway": "2.6.2",
"@apollo/gateway": "2.8.0",
"@apollo/server": "4.10.4",
"graphql": "16.8.1"
}
}
3 changes: 3 additions & 0 deletions federation/src/main/scala/caliban/federation/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import caliban.federation.v2x.{
FederationDirectivesV2_3,
FederationDirectivesV2_5,
FederationDirectivesV2_6,
FederationDirectivesV2_8,
FederationV2,
Versions
}
Expand All @@ -17,5 +18,7 @@ package object federation {
lazy val v2_4 = new FederationV2(List(Versions.v2_4)) with FederationDirectivesV2_3
lazy val v2_5 = new FederationV2(List(Versions.v2_5)) with FederationDirectivesV2_5
lazy val v2_6 = new FederationV2(List(Versions.v2_6)) with FederationDirectivesV2_6
lazy val v2_7 = new FederationV2(List(Versions.v2_7)) with FederationDirectivesV2_6
lazy val v2_8 = new FederationV2(List(Versions.v2_8)) with FederationDirectivesV2_8

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package caliban.federation.v2x

import caliban.Value.StringValue
import caliban.parsing.adt.Directive
import caliban.schema.Annotations.GQLDirective

trait FederationDirectivesV2_8 extends FederationDirectivesV2_6 {

def Context(context: String) = Directive("context", Map("context" -> StringValue(context)))

case class GQLContext(context: String) extends GQLDirective(Context(context))

def FromContext(context: String) = Directive("fromContext", Map("context" -> StringValue(context)))

case class GQLFromContext(context: String) extends GQLDirective(FromContext(context))
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,14 @@ object FederationV2 {
`import` = v2_5.`import` :+ Import("@policy")
)

private[v2x] val v2_7 = Link(
url = s"$federationV2Url/v2.7",
`import` = v2_6.`import`
)

private[v2x] val v2_8 = Link(
url = s"$federationV2Url/v2.8",
`import` = v2_7.`import` :+ Import("@context") :+ Import("@fromContext")
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ object Versions {
val v2_4 = FederationV2.v2_4
val v2_5 = FederationV2.v2_5
val v2_6 = FederationV2.v2_6
val v2_7 = FederationV2.v2_7
val v2_8 = FederationV2.v2_8

}

0 comments on commit 67a34ac

Please sign in to comment.