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

Compound key support in federation #1011

Merged
merged 2 commits into from
Feb 6, 2020
Merged

Commits on Feb 5, 2020

  1. Extending federation to support compound keys per Apollo spec

    Summary:
    Compound keys are not yet supported for federation in gqlgen. This diff adds support by modifying the federation plugin to handle a list of key fields on an entity rather than a single top-level key field. It will now look for "find<EntityName>By<KeyField1><KeyField2>..." in the resolver, rather than the original "Find<EntityName>By<KeyField>". The federation plugin does not yet support more complicated FieldSets in the key, such as nested selections.
    
    References:
    - Apollo federation spec: https://www.apollographql.com/docs/apollo-server/federation/federation-spec/
    - Selection sets: https://graphql.github.io/graphql-spec/draft/#sec-Selection-Sets
    
    Will update https://phabricator.khanacademy.org/D59469 with multiple key changes.
    
    Test Plan:
    - Tested Go GQL services using both single- and multiple-key federated types (assignments and content-library in webapp/services)
    - Ran gqlgen on non-federated services in webapp to ensure regular generation still works (donations service)
    - WIP: creating unit tests; will submit as separate diff
    
    Reviewers: briangenisio, dhruv, csilvers, O4 go-vernors
    
    Reviewed By: dhruv, csilvers, O4 go-vernors
    
    Differential Revision: https://phabricator.khanacademy.org/D59569
    lizfaubell committed Feb 5, 2020
    Configuration menu
    Copy the full SHA
    3f714a4 View commit details
    Browse the repository at this point in the history
  2. Adding type with multiple keys to federation test

    Summary: The current federation test schema only has types with single keys (or no keys). Adding a type with multiple keys, including one non-String key, to test compound key federation code gen.
    
    Test Plan: - go test
    
    Reviewers: csilvers, miguel
    
    Differential Revision: https://phabricator.khanacademy.org/D60715
    lizfaubell committed Feb 5, 2020
    Configuration menu
    Copy the full SHA
    6540163 View commit details
    Browse the repository at this point in the history