-
Notifications
You must be signed in to change notification settings - Fork 189
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
graphql_sync first return value is a boolean. The docs say
True when no errors occurred, False otherwise.
I noticed that with ariadne==0.26.1 sometimes this boolean is wrong. Here is an example with wrong input types being used. The response data contains error messages, but the success boolean stays True. Not sure if this is by design or a bug:
from ariadne import MutationType, QueryType, graphql_sync, make_executable_schema
query = QueryType()
mutation = MutationType()
@query.field("dummy")
def resolve_dummy(*_, **kwargs):
return True
@mutation.field("myTestMutation")
def resolve_my_test_mutation(*_, **kwargs) -> dict:
inputs = kwargs["input"]
print(inputs)
return {"success": True}
SCHEMA = """
type Query {
dummy: Boolean!
}
type Mutation {
myTestMutation(input: MyTestMutationInput!): MyTestMutationResult!
}
input MyTestMutationInput {
name: String!
}
type MyTestMutationResult {
success: Boolean!
}
"""
def test_wrong_inputs():
querystr = """
mutation MyTestMutation($input: MyTestMutationInput!) {
myTestMutation(input: $input) {
success
}
}
"""
variables = {"input": {"namee": 12}}
payload = {"query": querystr, "variables": variables}
schema = make_executable_schema(
SCHEMA,
query,
mutation,
convert_names_case=True,
)
success, result = graphql_sync(schema=schema, data=payload, debug=True)
assert successMetadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed