Skip to content

Commit

Permalink
Avoid usage of Enumeration.toString (issues with GraalVM)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegIlyenko committed May 13, 2018
1 parent 860e262 commit 80e67bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/sangria/introspection/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ package object introspection {
fields = fields[Unit, Directive](
Field("name", StringType, resolve = _.value.name),
Field("description", OptionType(StringType), resolve = _.value.description),
Field("locations", ListType(__DirectiveLocation), resolve = _.value.locations.toVector.sortBy(_.toString)),
Field("locations", ListType(__DirectiveLocation), resolve = _.value.locations.toVector.sorted),
Field("args", ListType(__InputValue), resolve = _.value.arguments),
Field("onOperation", BooleanType,
deprecationReason = Some("Use `locations`."),
Expand Down
29 changes: 12 additions & 17 deletions src/main/scala/sangria/schema/Schema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -666,29 +666,24 @@ sealed trait HasArguments {
}

object DirectiveLocation extends Enumeration {
// Operations

val Query = Value
val Mutation = Value
val Subscription = Value
val ArgumentDefinition = Value
val Enum = Value
val EnumValue = Value
val Field = Value
val FieldDefinition = Value
val FragmentDefinition = Value
val FragmentSpread = Value
val InlineFragment = Value

// Schema Definitions

val Schema = Value
val Scalar = Value
val Object = Value
val FieldDefinition = Value
val ArgumentDefinition = Value
val InputFieldDefinition = Value
val InputObject = Value
val Interface = Value
val Mutation = Value
val Object = Value
val Query = Value
val Scalar = Value
val Schema = Value
val Subscription = Value
val Union = Value
val Enum = Value
val EnumValue = Value
val InputObject = Value
val InputFieldDefinition = Value

def fromString(location: String): DirectiveLocation.Value = location match {
case "QUERY" Query
Expand Down

0 comments on commit 80e67bc

Please sign in to comment.