Skip to content

Commit

Permalink
fix mima
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpdaniels committed Aug 20, 2023
1 parent c506593 commit 2ea4b03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions core/src/main/scala/caliban/Rendering.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ object Rendering {
def renderSchemaDirectives(directives: List[Directive]): String =
DocumentRenderer.directivesRenderer.render(directives)

def renderDirectives(directives: List[__Directive]): String =
DocumentRenderer.directiveDefinitionsRenderer.render(directives.map(_.toDirectiveDefinition))

@deprecated("Prefer DocumentRenderer.descriptionRenderer instead", "2.3.1")
private[caliban] def renderDescription(description: Option[String], newline: Boolean = true): String =
if (newline) DocumentRenderer.descriptionRenderer.render(description)
Expand Down
7 changes: 5 additions & 2 deletions core/src/main/scala/caliban/rendering/DocumentRenderer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ object DocumentRenderer extends Renderer[Document] {
}

private[caliban] lazy val documentRenderer: Renderer[Document] = Renderer.combine(
directiveDefinitionRenderer.list(Renderer.char('\n')).contramap(_.directiveDefinitions),
directiveDefinitionsRenderer.contramap(_.directiveDefinitions),
schemaRenderer.optional.contramap(_.schemaDefinition),
operationDefinitionRenderer.list(Renderer.newlineOrSpace).contramap(_.operationDefinitions),
typeDefinitionsRenderer.contramap(_.typeDefinitions),
fragmentRenderer.list.contramap(_.fragmentDefinitions)
)

private[caliban] lazy val directiveDefinitionsRenderer: Renderer[List[DirectiveDefinition]] =
directiveDefinitionRenderer.list(Renderer.newline)

private[caliban] lazy val __typeNameRenderer: Renderer[__Type] = new Renderer[__Type] {
override def unsafeRender(value: __Type, indent: Option[Int], write: StringBuilder): Unit = {
def loop(typ: Option[__Type]): Unit = typ match {
Expand All @@ -77,7 +80,7 @@ object DocumentRenderer extends Renderer[Document] {
}
}

private lazy val directiveDefinitionRenderer: Renderer[DirectiveDefinition] =
private[caliban] lazy val directiveDefinitionRenderer: Renderer[DirectiveDefinition] =
new Renderer[DirectiveDefinition] {
private val inputRenderer = inputValueDefinitionRenderer.list(Renderer.char(',') ++ Renderer.space)
private val locationsRenderer: Renderer[Set[DirectiveLocation]] =
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/scala/caliban/rendering/Renderer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ object Renderer {
if (indent.isDefined) write.append('\n') else write.append(' ')
}

lazy val newline: Renderer[Any] =
Renderer.char('\n')

private final case class Combined[-A](renderers: List[Renderer[A]]) extends Renderer[A] {
override def unsafeRender(value: A, indent: Option[Int], write: StringBuilder): Unit =
renderers.foreach(_.unsafeRender(value, indent, write))
Expand Down

0 comments on commit 2ea4b03

Please sign in to comment.