This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ApolloServer } = require("apollo-server"); | |
const { ApolloGateway, RemoteGraphQLDataSource } = require("@apollo/gateway"); | |
const gateway = new ApolloGateway({ | |
serviceList: [ | |
{ name: "saleor", url: "http://localhost:8000/graphql/" }, | |
{ name: "reviews", url: "http://localhost:8080/" }, | |
], | |
buildService({ name, url }) { | |
return new RemoteGraphQLDataSource({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User @key(fields: "id") @extends { | |
id: ID! @external | |
reviews: [Review] | |
} | |
type Review @key(fields: "id") { | |
id: ID! | |
title: String | |
author: User | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass | |
from typing import List | |
from ariadne import ObjectType, MutationType, QueryType, snake_case_fallback_resolvers | |
from ariadne_extensions import federation | |
from ariadne.asgi import GraphQL | |
query = QueryType() | |
manager = federation.FederatedManager(query=query, schema_sdl_file="schema.graphql") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import graphene | |
class House(graphene.ObjectType): | |
name = graphene.String(required=True) | |
castle = graphene.String(required=True) | |
members = graphene.List(graphene.NonNull(lambda: Person)) | |
class Person(graphene.ObjectType): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ariadne import ObjectType, QueryType, gql, make_executable_schema | |
from ariadne.asgi import GraphQL | |
type_defs = gql( | |
""" | |
type Person { | |
name: String | |
house: House | |
parents: [Person!] | |
isAlive: Boolean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalar Date | |
type Person { | |
name: String | |
house: House | |
parents: [Person!] | |
isAlive: Boolean | |
} | |
type House { |