Skip to content
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

fix: Adds support for defining Interface entities resolvers #262

Closed
wants to merge 4 commits into from

Commits on Sep 8, 2023

  1. feat: adds support for Interface Entities

    Context: In Federation v2.3 there was added support for interfaces to be
    Entities. There are two ways to consume this new feature.
    
    1. Extend an Interface Entity with the `@interfaceObject` directive,
       when the Entity is defined by a different subgraph.
    
    2. Implement the Interface Entity with its implementing Type Entitites.
    
    There was previos work into getting the first part covered in this gem,
    but we were still lacking support for the 2nd part. This work address
    that.
    
    The main issue here is the fact that an `Union` in `GraphQL` can't be an
    `Interface` according to the [spec](https://spec.graphql.org/October2021/#sec-Unions.Type-Validation), but at the same time, according to the Apollo Federation [spec](https://www.apollographql.com/docs/federation/federated-types/interfaces), an interface can be an Entity, and an Entity is an Union. Therefore, we have to extend the validation (`assert_valid_union_member`) for the Entity union to allow `Interfaces` (more exactly `Modules`) as possible types.
    moonflare committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    a9735b3 View commit details
    Browse the repository at this point in the history
  2. fix: adds underscore_reference_keys support to interfaces

    In a previous Pull Request (Gusto#248) there was added support for underscoring the keys and while this covered the `Object` class, it didn't also cover the `Interface` module. This commit adds the same `underscore_reference_keys` method to the `Interface` module.
    moonflare committed Sep 8, 2023
    Configuration menu
    Copy the full SHA
    dd010ff View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8d6c530 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2023

  1. fix: ensure all interface members are also entities

    Every entity that implements an interface entity must include all `@keys` from the interface definition.
    Therefore, we add this extra validation to ensure that.
    nogates authored and moonflare committed Sep 13, 2023
    Configuration menu
    Copy the full SHA
    d8ce3c2 View commit details
    Browse the repository at this point in the history