Home / Companies / Wundergraph / Blog / Post Details
Content Deep Dive

Zero-Cost Abstractions for @skip and @include in Federated GraphQL

Blog post from Wundergraph

Post Details
Company
Date Published
Author
Jens Neuse
Word Count
3,270
Language
English
Hacker News Points
1
Summary

The Cosmo Router is a GraphQL API Gateway that routes requests from clients to Subgraphs, implementing the GraphQL Federation contract. The Router can be built from source or run as a Docker container. Most users prefer using published Docker images for customizations. The Cosmo Router's goal is to minimize network requests. The article discusses three approaches to implementing the `@skip` and `@include` directives in the Router: Subgraph Directive Evaluation Approach, Smart but expensive Approach, and Zero-Cost Abstraction. The Zero-Cost Abstraction normalizes the query by removing unnecessary fields that are skipped or included using these directives, resulting in a significant reduction in latency and improved performance.