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

feat: validate subgraph fetches #124

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

lennyburdette
Copy link
Member

This doesn't work yet because operation signatures aren't always valid documents.

@lennyburdette
Copy link
Member Author

This is a false negative — the operation signature drops input fields.

storefrontGatewayCancellationSubmit a5eea3
==========================================
https://studio.apollographql.com/graph/xxx/operations?xxx&queryName=storefrontGatewayCancellationSubmit&variant=xxx

💣 Federation 1 supergraph query plan has subgraph fetch nodes that will fail
💣 Federation 2 supergraph query plan has subgraph fetch nodes that will fail
🎉 No difference in query plans

Subgraph fetch errors (Federation 1 supergraph)
-----------------------------------------------
* [service-eng-order-access-gql-federation] Field "CustomerOrderCancellationInput.orderProducts" of required type "[CancellationOrderProductInput!]!" was not provided.
    ```graphql
    mutation storefrontGatewayCancellationSubmit__service_eng_order_access_gql_federation__0 {
      requestCustomerOrderCancellation(customerOrderCancellation: {}) {
        __typename
        formattedRefundAmount
        orderProducts {
          __typename
          id
          status
        }
      }
    }
    ```
* [service-eng-order-access-gql-federation] Field "CustomerOrderCancellationInput.runId" of required type "ID!" was not provided.
    ```graphql
    mutation storefrontGatewayCancellationSubmit__service_eng_order_access_gql_federation__0 {
      requestCustomerOrderCancellation(customerOrderCancellation: {}) {
        __typename
        formattedRefundAmount
        orderProducts {
          __typename
          id
          status
        }
      }
    }
    ```

Subgraph fetch errors (Federation 2 supergraph)
-----------------------------------------------
* [service-eng-order-access-gql-federation] Field "CustomerOrderCancellationInput.orderProducts" of required type "[CancellationOrderProductInput!]!" was not provided.
    ```graphql
    mutation storefrontGatewayCancellationSubmit__service_eng_order_access_gql_federation__0 {
      requestCustomerOrderCancellation(customerOrderCancellation: {}) {
        __typename
        formattedRefundAmount
        orderProducts {
          __typename
          id
          status
        }
      }
    }
    ```
* [service-eng-order-access-gql-federation] Field "CustomerOrderCancellationInput.runId" of required type "ID!" was not provided.
    ```graphql
    mutation storefrontGatewayCancellationSubmit__service_eng_order_access_gql_federation__0 {
      requestCustomerOrderCancellation(customerOrderCancellation: {}) {
        __typename
        formattedRefundAmount
        orderProducts {
          __typename
          id
          status
        }
      }
    }
    ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant