Skip to content

Commit 0ffc63d

Browse files
committed
Add missing documentation (#134)
1 parent ab209c4 commit 0ffc63d

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

docs/modules/language.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ Directive locations are specified using the following enumeration:
7373

7474
.. autoclass:: DirectiveLocation
7575

76+
You can also check the type of nodes with the following predicates:
77+
78+
.. autofunction:: is_definition_node
79+
.. autofunction:: is_executable_definition_node
80+
.. autofunction:: is_selection_node
81+
.. autofunction:: is_value_node
82+
.. autofunction:: is_type_node
83+
.. autofunction:: is_type_system_definition_node
84+
.. autofunction:: is_type_definition_node
85+
.. autofunction:: is_type_system_extension_node
86+
.. autofunction:: is_type_extension_node
87+
7688
Lexer
7789
-----
7890

@@ -94,6 +106,11 @@ Parser
94106
.. autofunction:: parse_type
95107
.. autofunction:: parse_value
96108

109+
Printer
110+
-------
111+
112+
.. autofunction:: print_ast
113+
97114
Source
98115
------
99116

src/graphql/language/predicates.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,45 @@
2525

2626

2727
def is_definition_node(node: Node) -> bool:
28+
"""Check whether the given node represents a definition."""
2829
return isinstance(node, DefinitionNode)
2930

3031

3132
def is_executable_definition_node(node: Node) -> bool:
33+
"""Check whether the given node represents an executable definition."""
3234
return isinstance(node, ExecutableDefinitionNode)
3335

3436

3537
def is_selection_node(node: Node) -> bool:
38+
"""Check whether the given node represents a selection."""
3639
return isinstance(node, SelectionNode)
3740

3841

3942
def is_value_node(node: Node) -> bool:
43+
"""Check whether the given node represents a value."""
4044
return isinstance(node, ValueNode)
4145

4246

4347
def is_type_node(node: Node) -> bool:
48+
"""Check whether the given node represents a type."""
4449
return isinstance(node, TypeNode)
4550

4651

4752
def is_type_system_definition_node(node: Node) -> bool:
53+
"""Check whether the given node represents a type system definition."""
4854
return isinstance(node, TypeSystemDefinitionNode)
4955

5056

5157
def is_type_definition_node(node: Node) -> bool:
58+
"""Check whether the given node represents a type definition."""
5259
return isinstance(node, TypeDefinitionNode)
5360

5461

5562
def is_type_system_extension_node(node: Node) -> bool:
63+
"""Check whether the given node represents a type system extension."""
5664
return isinstance(node, (SchemaExtensionNode, TypeExtensionNode))
5765

5866

5967
def is_type_extension_node(node: Node) -> bool:
68+
"""Check whether the given node represents a type extension."""
6069
return isinstance(node, TypeExtensionNode)

tests/utilities/test_print_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def prints_custom_scalar():
504504
"""
505505
)
506506

507-
def prints_custom_scalar_with_speicified_by_url():
507+
def prints_custom_scalar_with_specified_by_url():
508508
foo_type = GraphQLScalarType(
509509
name="Foo", specified_by_url="https://example.com/foo_spec"
510510
)

0 commit comments

Comments
 (0)