sangria.schema.AstNodeTransformer.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sangria-core_2.13 Show documentation
Show all versions of sangria-core_2.13 Show documentation
Scala GraphQL implementation
The newest version!
package sangria.schema
import sangria.ast.{AstLocation, AstNode, Comment}
import sangria.visitor._
object AstNodeTransformer {
def withoutAstLocations[T <: AstNode](node: T, stripComments: Boolean = false): T = {
val enterComment = (_: Comment) =>
if (stripComments) VisitorCommand.Delete else VisitorCommand.Continue
visit[AstNode](
node,
Visit[Comment](enterComment),
VisitAnyField[AstNode, Option[AstLocation]]((_, _) => VisitorCommand.Transform(None)))
.asInstanceOf[T]
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy