All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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)
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy