caliban.introspection.adt.__EnumValue.scala Maven / Gradle / Ivy
The newest version!
package caliban.introspection.adt
import caliban.Value.StringValue
import caliban.parsing.adt.Definition.TypeSystemDefinition.TypeDefinition.EnumValueDefinition
import caliban.parsing.adt.Directive
import caliban.schema.Annotations.GQLExcluded
case class __EnumValue(
name: String,
description: Option[String],
isDeprecated: Boolean,
deprecationReason: Option[String],
@GQLExcluded directives: Option[List[Directive]]
) {
def toEnumValueDefinition: EnumValueDefinition =
EnumValueDefinition(
description,
name,
(if (isDeprecated)
List(
Directive(
"deprecated",
List(deprecationReason.map(reason => "reason" -> StringValue(reason))).flatten.toMap
)
)
else Nil) ++ directives.getOrElse(Nil)
)
}