apollo-compiler@0.7.0
0.7.0 - 2023-03-27
Important: X breaking changes below, indicated by BREAKING
This release encompasses quite a few validation rules the compiler was missing.
Here, we primarily focused on field and directive validation, as well as supporting
multi-file diagnostics.
BREAKING
-
find_operationquery now mimics spec's
getOperation
functionality and returns the anonymous operation ifNoneis specified for
operation name; by lrlna in pull/447 -
Extensions are applied implicitly in HIR by SimonSapin in pull/481,
pull/482, and pull/484Adding a GraphQL type extension is similar to modifying a type.
This release makes a number of breaking changes to API signatures and behavior
so these modifications are accounted for implicitly.
For example,interface.field(name)may now return a field
from anextend interfaceextension or from the originalinterfacedefinition.
We expect that most callers don’t need to tell the difference.
For callers that do, methods with aself_prefix are added (or renamed)
for accessing components of a definition itself as opposed to added by an extension.Renamed methods:
-SchemaDefinition::root_operation_type_definition→self_root_operations
-ObjectTypeDefinition::fields_definition→self_fields
-InterfaceTypeDefinition::fields_definition→self_fields
-InputObjectTypeDefinition::input_fields_definition→self_fields
-ObjectTypeDefinition::implements_interfaces→self_implements_interfaces
-InterfaceTypeDefinition::implements_interfaces→self_implements_interfaces
-UnionTypeDefinition::union_members→self_members
-EnumTypeDefinition::enum_values_definition→self_values
-TypeDefiniton::directives→self_directives
-SchemaDefiniton::directives→self_directives
-EnumTypeDefiniton::directives→self_directives
-UnionTypeDefiniton::directives→self_directives
-ObjectTypeDefiniton::directives→self_directives
-ScalarTypeDefiniton::directives→self_directives
-InterfaceTypeDefiniton::directives→self_directives
-InputObjectTypeDefiniton::directives→self_directivesMethod names freed by the above are now redefined with new behaviour and
signature, and include extensions:
-ObjectTypeDefinition::implements_interfaces() -> impl Iterator
-InterfaceTypeDefinition::implements_interfaces() -> impl Iterator
-TypeDefiniton::directives() -> impl Iterator
-SchemaDefiniton::directives() -> impl Iterator
-EnumTypeDefiniton::directives() -> impl Iterator
-UnionTypeDefiniton::directives() -> impl Iterator
-ObjectTypeDefiniton::directives() -> impl Iterator
-ScalarTypeDefiniton::directives() -> impl Iterator
-InterfaceTypeDefiniton::directives() -> impl Iterator
-InputObjectTypeDefiniton::directives() -> impl IteratorMethods whose behaviour and signature changed, where each method now returns the
name of an object type instead of its definition:
-SchemaDefinition::query() -> Option<&str>
-SchemaDefinition::mutation() -> Option<&str>
-SchemaDefinition::subscription() -> Option<&str>Methods whose behaviour changed to consider extensions, and no signature has changed
-TypeDefinition::field(name) -> Option
-ObjectTypeDefinition::field(name) -> Option
-InterfaceTypeDefinition::field(name) -> OptionNew methods which take extensions into consideration:
-SchemaDefinition::root_operations() -> impl Iterator
-ObjectTypeDefinition::fields() -> impl Iterator
-ObjectTypeDefinition::implements_interface(name) -> bool
-InterfaceTypeDefinition::fields() -> impl Iterator
-InterfaceTypeDefinition::implements_interface(name) -> bool
-InputObjectTypeDefinition::self_fields() -> &[_]
-InputObjectTypeDefinition::fields() -> impl Iterator
-InputObjectTypeDefinition::field(name) -> Option
-UnionTypeDefinition::members() -> impl Iterator
-UnionTypeDefinition::has_member(name) -> bool
-EnumTypeDefinition::values() -> impl Iterator
-EnumTypeDefinition::value(name) -> OptionNew methods for every type which have a
directivesmethod:
-directive_by_name(name) -> Option
-directives_by_name(name) -> impl Iterator
Features
- support mutli-file diagnostics by goto-bus-stop in pull/414
- validate directive locations by lrlna in pull/417
- validate undefined directives by lrlna in pull/417
- validate non-repeatable directives in a given location by goto-bus-stop in pull/488
- validate conflicting fields in a selection set (spec: fields can merge) by goto-bus-stop in pull/470
- validate introspection fields in subscriptions by gocamille in [pull/438]
- validate required arguments by goto-bus-stop in pull/452
- validate unique variables by lrlna in pull/455
- validate variables are of input type by lrlna in pull/455
- validate root operation type is of Object Type by lrlna in pull/419
- validate nested fields in selection sets by erikwrede in pull/441
- validate extension existance and kind by goto-bus-stop in pull/458
- validate leaf field selection by [yanns] in pull/465
- introduce
op.is_introspectionhelper method by jregistr in pull/421 - built-in graphql types, including introspection types, are now part of the
compiler context by lrlna in pull/489
Fixes
- fix variables in directive arguments being reported as unused goto-bus-stop in pull/487
op.operation_ty()does not deref lrlna in pull/434
Maintenance
- tests for operation field type resolution v.s. type extensions by SimonSapin in pull/492
- using [salsa::invoke] macro to annotate trait function location by lrlna in pull/491
- use
Displayforhir::OperationTypeandhir::DirectiveLocationby goto-bus-stop in pull/435 - rework and simplify validation database by lrlna in pull/436
- reset
FileIdbetween directory tests by goto-bus-stop in pull/437 - remove unncessary into_iter() calls by goto-bus-stop in pull/472
- check test numbers are unique in test output files by goto-bus-stop in pull/471