Skip to content

apollo-compiler@0.7.0

Choose a tag to compare

@lrlna lrlna released this 28 Mar 11:03
· 579 commits to main since this release
020bbfb

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_operation query now mimics spec's
    getOperation
    functionality and returns the anonymous operation if None is specified for
    operation name; by lrlna in pull/447

  • Extensions are applied implicitly in HIR by SimonSapin in pull/481,
    pull/482, and pull/484

    Adding 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 an extend interface extension or from the original interface definition.
    We expect that most callers don’t need to tell the difference.
    For callers that do, methods with a self_ 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_definitionself_root_operations
    - ObjectTypeDefinition::fields_definitionself_fields
    - InterfaceTypeDefinition::fields_definitionself_fields
    - InputObjectTypeDefinition::input_fields_definitionself_fields
    - ObjectTypeDefinition::implements_interfacesself_implements_interfaces
    - InterfaceTypeDefinition::implements_interfacesself_implements_interfaces
    - UnionTypeDefinition::union_membersself_members
    - EnumTypeDefinition::enum_values_definitionself_values
    - TypeDefiniton::directivesself_directives
    - SchemaDefiniton::directivesself_directives
    - EnumTypeDefiniton::directivesself_directives
    - UnionTypeDefiniton::directivesself_directives
    - ObjectTypeDefiniton::directivesself_directives
    - ScalarTypeDefiniton::directivesself_directives
    - InterfaceTypeDefiniton::directivesself_directives
    - InputObjectTypeDefiniton::directivesself_directives

    Method 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 Iterator

    Methods 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) -> Option

    New 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) -> Option

    New methods for every type which have a directives method:
    - directive_by_name(name) -> Option
    - directives_by_name(name) -> impl Iterator

Features

Fixes

Maintenance