Skip to content

Commit 59f2cd3

Browse files
authored
Merge pull request rmosolgo#3877 from rmosolgo/make-introspection-query-backwards-compatible
Make the introspection query backwards-compatible by default
2 parents dc3e841 + 6a708cb commit 59f2cd3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/graphql/introspection.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# frozen_string_literal: true
22
module GraphQL
33
module Introspection
4-
def self.query(include_deprecated_args: false)
4+
def self.query(include_deprecated_args: false, include_schema_description: false, include_is_repeatable: false, include_specified_by_url: false)
55
# The introspection query to end all introspection queries, copied from
66
# https://github.com/graphql/graphql-js/blob/master/src/utilities/introspectionQuery.js
77
<<-QUERY
88
query IntrospectionQuery {
99
__schema {
10-
description
10+
#{include_schema_description ? "description" : ""}
1111
queryType { name }
1212
mutationType { name }
1313
subscriptionType { name }
@@ -18,7 +18,7 @@ def self.query(include_deprecated_args: false)
1818
name
1919
description
2020
locations
21-
isRepeatable
21+
#{include_is_repeatable ? "isRepeatable" : ""}
2222
args#{include_deprecated_args ? '(includeDeprecated: true)' : ''} {
2323
...InputValue
2424
}
@@ -29,7 +29,7 @@ def self.query(include_deprecated_args: false)
2929
kind
3030
name
3131
description
32-
specifiedByUrl
32+
#{include_specified_by_url ? "specifiedByUrl" : ""}
3333
fields(includeDeprecated: true) {
3434
name
3535
description

spec/graphql/schema/loader_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def self.coerce_result(value, _ctx)
150150
}
151151

152152
let(:schema_json) {
153-
schema.execute(GraphQL::Introspection.query(include_deprecated_args: true))
153+
schema.execute(GraphQL::Introspection.query(include_deprecated_args: true, include_schema_description: true, include_specified_by_url: true, include_is_repeatable: true))
154154
}
155155

156156
describe "load" do

0 commit comments

Comments
 (0)