Skip to content

Commit 54fe279

Browse files
committed
Add test for oneOf support and fix linting
1 parent 6c92a65 commit 54fe279

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ disallow_untyped_defs = false
294294
[tool.pyright]
295295
reportIncompatibleVariableOverride = false
296296
reportMissingTypeArgument = false
297+
reportReturnType = false
297298
reportUnknownArgumentType = false
298299
reportUnknownMemberType = false
299300
reportUnknownParameterType = false

src/graphql/utilities/build_client_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def build_input_object_def(
256256
fields=lambda: build_input_value_def_map(
257257
input_object_introspection["inputFields"]
258258
),
259-
is_one_of=input_object_introspection.get("isOneOf"),
259+
is_one_of=input_object_introspection.get("isOneOf", False),
260260
)
261261

262262
type_builders: dict[str, Callable[[IntrospectionType], GraphQLNamedType]] = {

tests/utilities/test_build_client_schema.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,22 @@ def builds_a_schema_with_specified_by_url():
594594

595595
assert cycle_introspection(sdl) == sdl
596596

597+
def builds_a_schema_with_one_of_directive():
598+
sdl = dedent(
599+
"""
600+
type Query {
601+
someField(someArg: SomeInputObject): String
602+
}
603+
604+
input SomeInputObject @oneOf {
605+
someInputField1: String
606+
someInputField2: String
607+
}
608+
"""
609+
)
610+
611+
assert cycle_introspection(sdl) == sdl
612+
597613
def can_use_client_schema_for_limited_execution():
598614
schema = build_schema(
599615
"""

tests/utilities/test_get_introspection_query.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import re
44
from typing import Pattern
5+
56
from graphql.language import parse
67
from graphql.utilities import build_schema, get_introspection_query
78
from graphql.validation import validate

0 commit comments

Comments
 (0)