Skip to content

vinh0604/netflix-dgs-federation-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Netflix DGS Federation Example

Federation example for netflix-dgs-framework that closely resembles the subgraphs example used in the Apollo Federation documentation

Subgraphs

graph TD
    A[Gateway] --> B(Products subgraph)
    A[Gateway] --> C(Accounts subgraph)
    A[Gateway] --> D(Reviews subgraph)
    A[Gateway] --> E(Inventory subgraph)
Loading

Products subgraph

type Query {
    topProducts(first: Int = 5): [Product]
}

type Product @key(fields: "upc") {
    upc: String!
    name: String
    price: Int
    weight: Int
}

Accounts subgraph

type Query {
    me: User
}

type User @key(fields: "id") {
    id: ID!
    name: String
    username: String
}

Reviews subgraph

type Review @key(fields: "id") {
    id: ID!
    body: String
    author: User @provides(fields: "username")
    product: Product
}

type User @key(fields: "id") @extends {
    id: ID! @external
    username: String @external
    reviews: [Review]
}

type Product @key(fields: "upc") @extends {
    upc: String! @external
    reviews: [Review]
}

Inventory subgraph

type Product @key(fields: "upc") @extends {
    upc: String! @external
    weight: Int @external
    price: Int @external
    inStock: Boolean
    shippingEstimate: Int @requires(fields: "price weight")
}

About

Apollo Federation examples with Netflix DGS Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published