Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

Commit

Permalink
Remove deprecated introspection fields. Closes sangria-graphql#411
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegIlyenko committed Oct 6, 2018
1 parent 343d7a5 commit aa020cd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 64 deletions.
19 changes: 1 addition & 18 deletions src/main/scala/sangria/introspection/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -252,24 +252,7 @@ package object introspection {
Field("name", StringType, resolve = _.value.name),
Field("description", OptionType(StringType), resolve = _.value.description),
Field("locations", ListType(__DirectiveLocation), resolve = _.value.locations.toVector.sorted),
Field("args", ListType(__InputValue), resolve = _.value.arguments),
Field("onOperation", BooleanType,
deprecationReason = Some("Use `locations`."),
resolve = c
c.value.locations.contains(DirectiveLocation.Query) ||
c.value.locations.contains(DirectiveLocation.Mutation) ||
c.value.locations.contains(DirectiveLocation.Subscription)),
Field("onFragment", BooleanType,
deprecationReason = Some("Use `locations`."),
resolve = c
c.value.locations.contains(DirectiveLocation.FragmentDefinition) ||
c.value.locations.contains(DirectiveLocation.FragmentSpread) ||
c.value.locations.contains(DirectiveLocation.InlineFragment)),
Field("onField", BooleanType,
deprecationReason = Some("Use `locations`."),
resolve = _.value.locations.contains(DirectiveLocation.Field))
))

Field("args", ListType(__InputValue), resolve = _.value.arguments)))

val __Schema = ObjectType(
name = "__Schema",
Expand Down
41 changes: 1 addition & 40 deletions src/test/scala/sangria/introspection/IntrospectionSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,46 +110,7 @@ class IntrospectionSpec extends WordSpec with Matchers with FutureResultSupport
"name" "__InputValue",
"ofType" null)))),
"isDeprecated" false,
"deprecationReason" null),
Map(
"name" "onOperation",
"description" null,
"args" Vector.empty,
"type" Map(
"kind" "NON_NULL",
"name" null,
"ofType" Map(
"kind" "SCALAR",
"name" "Boolean",
"ofType" null)),
"isDeprecated" true,
"deprecationReason" "Use `locations`."),
Map(
"name" "onFragment",
"description" null,
"args" Vector.empty,
"type" Map(
"kind" "NON_NULL",
"name" null,
"ofType" Map(
"kind" "SCALAR",
"name" "Boolean",
"ofType" null)),
"isDeprecated" true,
"deprecationReason" "Use `locations`."),
Map(
"name" "onField",
"description" null,
"args" Vector.empty,
"type" Map(
"kind" "NON_NULL",
"name" null,
"ofType" Map(
"kind" "SCALAR",
"name" "Boolean",
"ofType" null)),
"isDeprecated" true,
"deprecationReason" "Use `locations`.")),
"deprecationReason" null)),
"inputFields" null,
"interfaces" Vector.empty,
"enumValues" null,
Expand Down
6 changes: 0 additions & 6 deletions src/test/scala/sangria/renderer/SchemaRenderSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,6 @@ class SchemaRenderSpec extends WordSpec with Matchers with FutureResultSupport w
| description: String
| locations: [__DirectiveLocation!]!
| args: [__InputValue!]!
| onOperation: Boolean! @deprecated(reason: "Use `locations`.")
| onFragment: Boolean! @deprecated(reason: "Use `locations`.")
| onField: Boolean! @deprecated(reason: "Use `locations`.")
|}
|
|"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies."
Expand Down Expand Up @@ -787,9 +784,6 @@ class SchemaRenderSpec extends WordSpec with Matchers with FutureResultSupport w
| description: String
| locations: [__DirectiveLocation!]!
| args: [__InputValue!]!
| onOperation: Boolean! @deprecated(reason: "Use `locations`.")
| onFragment: Boolean! @deprecated(reason: "Use `locations`.")
| onField: Boolean! @deprecated(reason: "Use `locations`.")
|}
|
|# A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.
Expand Down

0 comments on commit aa020cd

Please sign in to comment.