commits
Variables were being lost when traversing into nested contexts during
query execution. Now uses context_with_variables to preserve variables.
Previously, when checking if a field type was a union to trigger type
resolution, the executor only matched bare UnionType. This caused
NonNull(UnionType) fields (like connection edge nodes) to skip union
resolution, resulting in incorrect __typename values and empty inline
fragment results.
The fix unwraps NonNull before checking is_union, matching how list
items are already handled.
- Add type registry to ensure union types resolve to complete type definitions
- Make build_type_map public in introspection module
- Add get_union_type_resolver and resolve_union_type_with_registry functions
- Add test for union resolution with all fields via registry
- Bump version to 2.1.2
Verifies that introspecting a union type correctly returns all
possible types in the possibleTypes field. This test would have
caught the bug fixed in 49fac31.
Union types have 0 content count but still need their possible_types
to be traversed. The previous logic would skip types with 0 content
if any instance with the same name already existed, even with 0 content.
Now we always traverse a type the first time we see its name, ensuring
unions and their possible_types are properly collected.
The executor was checking is_union() on the inner type of list items,
but after unwrapping List[NonNull[Union]], the inner type is still
NonNull[Union], not Union directly. is_union() only returns true for
direct UnionType, so union type resolution was being skipped.
Now we unwrap one more level before checking is_union(), allowing
inline fragments on union types within arrays to resolve correctly.
- Validate argument types before resolving fields: list arguments now
produce helpful errors when passed objects instead of lists
- Add isOneOf field to type introspection for INPUT_OBJECT types
(GraphQL spec compliance)
Bump version to 2.0.1
- Add named_type_name function to get base type without List/NonNull wrappers
- Fix fragment spread type condition matching on NonNull/List wrapped types
- Fix inline fragment type condition matching with wrapped types
- Fix __typename to return concrete type name without modifiers
Add GraphQL spec-compliant default value support for variable definitions.
Features:
- Parse `$name: Type = defaultValue` syntax in queries, mutations, and subscriptions
- Apply default values during execution when variables are not provided
- Provided variables override default values
BREAKING CHANGE: Variable type now has 3 fields instead of 2.
Update pattern matches from `Variable(name, type_)` to `Variable(name, type_, default_value)`.
Add parse_type_reference function to handle GraphQL list type syntax
in variable definitions. Supports all list type variants:
- [Type] - nullable list of nullable items
- [Type!] - nullable list of non-null items
- [Type]! - non-null list of nullable items
- [Type!]! - non-null list of non-null items
Includes tests for all list type combinations.
Previously, when checking if a field type was a union to trigger type
resolution, the executor only matched bare UnionType. This caused
NonNull(UnionType) fields (like connection edge nodes) to skip union
resolution, resulting in incorrect __typename values and empty inline
fragment results.
The fix unwraps NonNull before checking is_union, matching how list
items are already handled.
Union types have 0 content count but still need their possible_types
to be traversed. The previous logic would skip types with 0 content
if any instance with the same name already existed, even with 0 content.
Now we always traverse a type the first time we see its name, ensuring
unions and their possible_types are properly collected.
The executor was checking is_union() on the inner type of list items,
but after unwrapping List[NonNull[Union]], the inner type is still
NonNull[Union], not Union directly. is_union() only returns true for
direct UnionType, so union type resolution was being skipped.
Now we unwrap one more level before checking is_union(), allowing
inline fragments on union types within arrays to resolve correctly.
Add GraphQL spec-compliant default value support for variable definitions.
Features:
- Parse `$name: Type = defaultValue` syntax in queries, mutations, and subscriptions
- Apply default values during execution when variables are not provided
- Provided variables override default values
BREAKING CHANGE: Variable type now has 3 fields instead of 2.
Update pattern matches from `Variable(name, type_)` to `Variable(name, type_, default_value)`.
Add parse_type_reference function to handle GraphQL list type syntax
in variable definitions. Supports all list type variants:
- [Type] - nullable list of nullable items
- [Type!] - nullable list of non-null items
- [Type]! - non-null list of nullable items
- [Type!]! - non-null list of non-null items
Includes tests for all list type combinations.