|
42 | 42 | UnionTypeExtensionNode,
|
43 | 43 | ValueNode,
|
44 | 44 | )
|
45 |
| -from ..pyutils import AwaitableOrValue, FrozenList, Path, cached_property, inspect |
| 45 | +from ..pyutils import ( |
| 46 | + AwaitableOrValue, |
| 47 | + FrozenList, |
| 48 | + Path, |
| 49 | + cached_property, |
| 50 | + inspect, |
| 51 | + is_description, |
| 52 | +) |
46 | 53 | from ..utilities.value_from_ast_untyped import value_from_ast_untyped
|
47 | 54 |
|
48 | 55 | if TYPE_CHECKING: # pragma: no cover
|
@@ -199,7 +206,7 @@ def __init__(
|
199 | 206 | raise TypeError("Must provide name.")
|
200 | 207 | if not isinstance(name, str):
|
201 | 208 | raise TypeError("The name must be a string.")
|
202 |
| - if description is not None and not isinstance(description, str): |
| 209 | + if description is not None and not is_description(description): |
203 | 210 | raise TypeError("The description must be a string.")
|
204 | 211 | if extensions is not None and (
|
205 | 212 | not isinstance(extensions, dict)
|
@@ -471,9 +478,9 @@ def __init__(
|
471 | 478 | "Field resolver must be a function if provided, "
|
472 | 479 | f" but got: {inspect(resolve)}."
|
473 | 480 | )
|
474 |
| - if description is not None and not isinstance(description, str): |
| 481 | + if description is not None and not is_description(description): |
475 | 482 | raise TypeError("The description must be a string.")
|
476 |
| - if deprecation_reason is not None and not isinstance(deprecation_reason, str): |
| 483 | + if deprecation_reason is not None and not is_description(deprecation_reason): |
477 | 484 | raise TypeError("The deprecation reason must be a string.")
|
478 | 485 | if extensions is not None and (
|
479 | 486 | not isinstance(extensions, dict)
|
@@ -589,7 +596,7 @@ def __init__(
|
589 | 596 | ) -> None:
|
590 | 597 | if not is_input_type(type_):
|
591 | 598 | raise TypeError(f"Argument type must be a GraphQL input type.")
|
592 |
| - if description is not None and not isinstance(description, str): |
| 599 | + if description is not None and not is_description(description): |
593 | 600 | raise TypeError("Argument description must be a string.")
|
594 | 601 | if out_name is not None and not isinstance(out_name, str):
|
595 | 602 | raise TypeError("Argument out name must be a string.")
|
@@ -1131,9 +1138,9 @@ def __init__(
|
1131 | 1138 | extensions: Dict[str, Any] = None,
|
1132 | 1139 | ast_node: EnumValueDefinitionNode = None,
|
1133 | 1140 | ) -> None:
|
1134 |
| - if description is not None and not isinstance(description, str): |
| 1141 | + if description is not None and not is_description(description): |
1135 | 1142 | raise TypeError("The description of the enum value must be a string.")
|
1136 |
| - if deprecation_reason is not None and not isinstance(deprecation_reason, str): |
| 1143 | + if deprecation_reason is not None and not is_description(deprecation_reason): |
1137 | 1144 | raise TypeError(
|
1138 | 1145 | "The deprecation reason for the enum value must be a string."
|
1139 | 1146 | )
|
@@ -1320,7 +1327,7 @@ def __init__(
|
1320 | 1327 | ) -> None:
|
1321 | 1328 | if not is_input_type(type_):
|
1322 | 1329 | raise TypeError(f"Input field type must be a GraphQL input type.")
|
1323 |
| - if description is not None and not isinstance(description, str): |
| 1330 | + if description is not None and not is_description(description): |
1324 | 1331 | raise TypeError("Input field description must be a string.")
|
1325 | 1332 | if out_name is not None and not isinstance(out_name, str):
|
1326 | 1333 | raise TypeError("Input field out name must be a string.")
|
|
0 commit comments