Skip to content

Road to v0.6.0 #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Sep 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1fdcc97
Combine invariants into AST-aware error. Commit https://github.com/gr…
markusdap Jul 29, 2016
8f1de86
Add test for deepened introspection query. Commit https://github.com/…
markusdap Jul 29, 2016
5524365
Include possible field, argument, type names when validation fails. C…
markusdap Jul 30, 2016
2df875f
Added suggestion_list module and test.
markusdap Aug 1, 2016
a0957e7
Merged in branch work.
markusdap Aug 1, 2016
e4afbd0
Bug: printer can print non-parsable value. Commit: https://github.com…
markusdap Aug 1, 2016
f40d1ed
Error logging for new interface type semantics and lint fixes. Commit…
markusdap Aug 8, 2016
a508cca
documentation of schema constructor. Commit: https://github.com/graph…
markusdap Aug 8, 2016
ee9f289
flake8 fix.
markusdap Aug 8, 2016
1e01278
Using ordereddict for key stability. Minor code fixes.
markusdap Aug 8, 2016
51af5fe
Started fixing isort failures.
markusdap Aug 8, 2016
88aac84
isorted files.
markusdap Aug 8, 2016
70ec948
isort fix.
markusdap Aug 8, 2016
226c246
BUG: Ensure building AST schema does not exclude @skip and @include. …
markusdap Aug 8, 2016
f8df3fa
Export directive definitions. Commit: https://github.com/graphql/grap…
markusdap Aug 8, 2016
0a7ce6d
Export introspection in public API. Commit: https://github.com/graphq…
markusdap Aug 8, 2016
2027aad
isort.
markusdap Aug 8, 2016
3ea2c91
Slight improvement of ensuring default directives.
markusdap Aug 8, 2016
f0c548d
Bring code closer to reference implementation.
markusdap Aug 9, 2016
dfb9f88
WIP.
markusdap Aug 12, 2016
0a16b27
Added missing directives string.
markusdap Aug 16, 2016
6f040fd
RFC: Schema Language Directives. Commit https://github.com/graphql/gr…
markusdap Aug 24, 2016
c646fca
RFC: Directive location: schema definition. Commit: https://github.co…
markusdap Aug 24, 2016
b0f9af7
Added Deprecated directive. Commit: https://github.com/graphql/graphq…
markusdap Sep 7, 2016
9d302f5
Factor out instance methods to normal methods. Commit: https://github…
markusdap Sep 7, 2016
4e752d5
factored out more instance methods. Commit: https://github.com/graphq…
markusdap Sep 7, 2016
ab7071a
Validation: context.getFragmentSpreads now accepts selectionSet rathe…
markusdap Sep 7, 2016
cd807c0
Validation: improving overlapping fields quality. Commit: https://git…
markusdap Sep 7, 2016
88e0102
isort import fixes.
markusdap Sep 7, 2016
51725d7
isort import fixes.
markusdap Sep 7, 2016
d45fda0
hopefully fixes isort.
markusdap Sep 7, 2016
84540ad
Merged in next branch.
markusdap Sep 8, 2016
bd2aa77
Fixed suggestion_list bug.
markusdap Sep 8, 2016
29ebeae
fix flake8.
markusdap Sep 8, 2016
e92d1e6
isort fix.
markusdap Sep 8, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
venv

# C extensions
*.so
Expand Down Expand Up @@ -61,6 +62,7 @@ target/

# IntelliJ
.idea
*.iml

# OS X
.DS_Store
52 changes: 52 additions & 0 deletions graphql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,46 @@
GraphQLInputObjectField,
GraphQLArgument,

# "Enum" of Type Kinds
TypeKind,

# "Enum" of Directive locations
DirectiveLocation,

# Scalars
GraphQLInt,
GraphQLFloat,
GraphQLString,
GraphQLBoolean,
GraphQLID,

# Directive definition
GraphQLDirective,

# Built-in directives defined by the Spec
specified_directives,
GraphQLSkipDirective,
GraphQLIncludeDirective,
GraphQLDeprecatedDirective,

# Constant Deprecation Reason
DEFAULT_DEPRECATION_REASON,

# GraphQL Types for introspection.
__Schema,
__Directive,
__DirectiveLocation,
__Type,
__Field,
__InputValue,
__EnumValue,
__TypeKind,

# Meta-field definitions.
SchemaMetaFieldDef,
TypeMetaFieldDef,
TypeNameMetaFieldDef,

# Predicates
is_type,
is_input_type,
Expand Down Expand Up @@ -190,6 +223,25 @@
'GraphQLSchema',
'GraphQLString',
'GraphQLUnionType',
'GraphQLDirective',
'specified_directives',
'GraphQLSkipDirective',
'GraphQLIncludeDirective',
'GraphQLDeprecatedDirective',
'DEFAULT_DEPRECATION_REASON',
'TypeKind',
'DirectiveLocation',
'__Schema',
'__Directive',
'__DirectiveLocation',
'__Type',
'__Field',
'__InputValue',
'__EnumValue',
'__TypeKind',
'SchemaMetaFieldDef',
'TypeMetaFieldDef',
'TypeNameMetaFieldDef',
'get_named_type',
'get_nullable_type',
'is_abstract_type',
Expand Down
22 changes: 12 additions & 10 deletions graphql/execution/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,18 @@ def complete_abstract_value(exe_context, return_type, field_asts, info, result):
else:
runtime_type = get_default_resolve_type_fn(result, exe_context.context_value, info, return_type)

assert isinstance(runtime_type, GraphQLObjectType), (
'Abstract type {} must resolve to an Object type at runtime ' +
'for field {}.{} with value "{}", received "{}".'
).format(
return_type,
info.parent_type,
info.field_name,
result,
runtime_type,
)
if not isinstance(runtime_type, GraphQLObjectType):
raise GraphQLError(
('Abstract type {} must resolve to an Object type at runtime ' +
'for field {}.{} with value "{}", received "{}".').format(
return_type,
info.parent_type,
info.field_name,
result,
runtime_type,
),
field_asts
)

if not exe_context.schema.is_possible_type(return_type, runtime_type):
raise GraphQLError(
Expand Down
15 changes: 0 additions & 15 deletions graphql/execution/tests/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,21 +285,6 @@ class Data(object):
assert result.data == {'second': 'b'}


def test_uses_the_named_operation_if_operation_name_is_provided():
doc = 'query Example { first: a } query OtherExample { second: a }'

class Data(object):
a = 'b'

ast = parse(doc)
Type = GraphQLObjectType('Type', {
'a': GraphQLField(GraphQLString)
})
result = execute(GraphQLSchema(Type), ast, Data(), operation_name='OtherExample')
assert not result.errors
assert result.data == {'second': 'b'}


def test_raises_if_no_operation_is_provided():
doc = 'fragment Example on Type { a }'

Expand Down
2 changes: 1 addition & 1 deletion graphql/execution/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_variable_values(schema, definition_asts, inputs):
return values


def get_argument_values(arg_defs, arg_asts, variables):
def get_argument_values(arg_defs, arg_asts, variables=None):
"""Prepares an object map of argument values given a list of argument
definitions and list of argument AST nodes."""
if not arg_defs:
Expand Down
Loading