Skip to content

Commit 77a3a40

Browse files
authored
introspection now requests deprecated input fields by default (#553)
1 parent 2d21100 commit 77a3a40

File tree

7 files changed

+21
-12
lines changed

7 files changed

+21
-12
lines changed

docs/gql-cli/intro.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ Print the GraphQL schema in a file
7979
8080
$ gql-cli https://countries.trevorblades.com/graphql --print-schema > schema.graphql
8181
82-
.. note::
83-
84-
By default, deprecated input fields are not requested from the backend.
85-
You can add :code:`--schema-download input_value_deprecation:true` to request them.
86-
8782
.. note::
8883

8984
You can add :code:`--schema-download descriptions:false` to request a compact schema
9085
without comments.
86+
87+
.. warning::
88+
89+
By default, from gql version 4.0, deprecated input fields are requested from the backend.
90+
It is possible that some old backends do not support this feature. In that case
91+
you can add :code:`--schema-download input_value_deprecation:false` to go back
92+
to the previous behavior.

docs/usage/validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The schema can be provided as a String (which is usually stored in a .graphql fi
2424
.. note::
2525
You can download a schema from a server by using :ref:`gql-cli <gql_cli>`
2626

27-
:code:`$ gql-cli https://SERVER_URL/graphql --print-schema --schema-download input_value_deprecation:true > schema.graphql`
27+
:code:`$ gql-cli https://SERVER_URL/graphql --print-schema > schema.graphql`
2828

2929
OR can be created using python classes:
3030

gql/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ def get_parser(with_examples: bool = False) -> ArgumentParser:
132132
By default, it will:
133133
134134
- request field descriptions
135-
- not request deprecated input fields
135+
- request deprecated input fields
136136
137137
Possible options:
138138
139139
- descriptions:false for a compact schema without comments
140-
- input_value_deprecation:true to download deprecated input fields
140+
- input_value_deprecation:false to omit deprecated input fields
141141
- specified_by_url:true
142142
- schema_description:true
143143
- directive_is_repeatable:true"""

gql/utilities/get_introspection_query_ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def get_introspection_query_ast(
1010
specified_by_url: bool = False,
1111
directive_is_repeatable: bool = False,
1212
schema_description: bool = False,
13-
input_value_deprecation: bool = False,
13+
input_value_deprecation: bool = True,
1414
type_recursion_level: int = 7,
1515
) -> DocumentNode:
1616
"""Get a query for introspection as a document using the DSL module.

tests/starwars/test_introspection.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ async def test_starwars_introspection_args(aiohttp_server):
1919
async with Client(
2020
transport=transport,
2121
fetch_schema_from_transport=True,
22+
introspection_args={
23+
"input_value_deprecation": False,
24+
},
2225
) as session:
2326

2427
schema_str = print_schema(session.client.schema)
@@ -35,6 +38,7 @@ async def test_starwars_introspection_args(aiohttp_server):
3538
fetch_schema_from_transport=True,
3639
introspection_args={
3740
"descriptions": False,
41+
"input_value_deprecation": False,
3842
},
3943
) as session:
4044

@@ -50,9 +54,6 @@ async def test_starwars_introspection_args(aiohttp_server):
5054
async with Client(
5155
transport=transport,
5256
fetch_schema_from_transport=True,
53-
introspection_args={
54-
"input_value_deprecation": True,
55-
},
5657
) as session:
5758

5859
schema_str = print_schema(session.client.schema)

tests/test_transport.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def client():
4343
url=URL, cookies={"csrftoken": csrf}, headers={"x-csrftoken": csrf}
4444
),
4545
fetch_schema_from_transport=True,
46+
introspection_args={
47+
"input_value_deprecation": False,
48+
},
4649
)
4750

4851

tests/test_transport_batch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def client():
4343
url=URL, cookies={"csrftoken": csrf}, headers={"x-csrftoken": csrf}
4444
),
4545
fetch_schema_from_transport=True,
46+
introspection_args={
47+
"input_value_deprecation": False,
48+
},
4649
)
4750

4851

0 commit comments

Comments
 (0)