Fast evolving GraphQL schema with federation (BWP304)

Detailed Summary

Introduction

  • The presentation focuses on the challenges and solutions around managing a fast-evolving GraphQL schema with Federation in the context of the "Buy with Prime" (Bu with Prime) service.
  • The presenters are Joseph (Solutions Architect), David Ramos (Principal Engineer), and Matt Quinlan (Senior Software Engineer) from the "Buy with Prime" team at Amazon.

Buy with Prime

  • Buy with Prime is a service that allows merchants to offer Amazon Prime benefits (e.g., delivery promise, customer service, returns) to their customers outside of amazon.com.
  • The data shows that Buy with Prime integration provides significant benefits to merchants, such as 20% increase in conversion rates and 75% of orders being "Buy with Prime" orders.
  • The core of the Buy with Prime offering is a GraphQL API that enables customers to interact with the service programmatically.

Managing Schema Changes and Versioning

  • The presenters discuss the challenges of managing schema changes and versioning in a GraphQL API, such as adding, removing, or changing field types.
  • They explain how the GraphQL specification recommends avoiding versioning and provides guidance on delegating authorization, but leaves some cross-cutting concerns unspecified.
  • The presenters introduce a solution called "Schema Projection", which involves:
    • Defining a base schema that contains all the changes
    • Using authoring directives (e.g., added, removed) to mark changes between versions
    • Generating version-specific schemas from the base schema using a configuration-driven projection tool

Federated Architecture

  • The presenters discuss the challenges of managing a federated architecture, where different teams own and operate independent services that contribute to the overall GraphQL API.
  • They explain how they pushed down the GraphQL composition into the individual services, allowing each team to manage their own schema versions and compose them together.
  • This approach enables independent testing and deployment of the underlying services, while still providing a cohesive GraphQL API to the clients.

Release Management

  • To ensure stability and predictability for clients, the presenters introduce the concept of "state" in their schema projections, where changes are marked as either "draft" or "released".
  • They enforce rules that ensure a "parent" projection can only include "released" projections from the underlying services, and that any changes to a "released" projection will break the build.
  • This allows teams to independently develop and test their changes in a "draft" state before marking them as "released" and making them available to the composed API.

Generative AI for Comprehensive Testing

  • The presenters discuss the challenges of comprehensively testing the composed GraphQL API, including covering all success paths, failure modes, and edge cases.
  • They introduce an approach that leverages generative AI (specifically, large language models) to generate test case descriptions, which are then transformed into executable test code.
  • The key aspects of this approach include:
    • Generating concise schema descriptions to provide context to the AI model
    • Crafting detailed prompts to guide the AI in generating comprehensive test cases
    • Incorporating "chain of thought" prompting to provide transparency into the AI's reasoning
    • Combining the generative AI approach with programmatic enumeration for systematic coverage

Conclusion and Next Steps

  • The presenters summarize the key takeaways from their approach to managing schema changes, federated architecture, and release management.
  • They also outline future areas of exploration, such as:
    • Chunking large schemas to improve the quality of generated tests
    • Expanding into multi-API interaction testing
    • Implementing a more robust feedback loop between test execution and test case generation
    • Exploring context-aware test evolution

Your Digital Journey deserves a great story.

Build one with us.

Cookies Icon

These cookies are used to collect information about how you interact with this website and allow us to remember you. We use this information to improve and customize your browsing experience, as well as for analytics.

If you decline, your information won’t be tracked when you visit this website. A single cookie will be used in your browser to remember your preference.

Talk to us