subgraphs:
connectors:
routing_url: none
schema:
sdl: |
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.10"
import: ["@key", "@external", "@requires", "@shareable"]
)
@link(
url: "https://specs.apollo.dev/connect/v0.1"
import: ["@connect", "@source"]
)
@source(
name: "json"
http: {
baseURL: "https://jsonplaceholder.typicode.com/"
headers: [
{ name: "x-new-name" from: "x-rename-source" }
{ name: "x-forward" from: "x-forward" }
{ name: "x-insert" value: "inserted" }
{ name: "x-config-variable-source" value: "before {$$config.source.val} after" }
{ name: "x-context-value-source", value: "before {$$context.val} after" }
]
}
)
type Query {
users: [User]
@connect(
source: "json"
http: {
GET: "/users"
headers: [
{name: "x-new-name", from: "x-rename-connect"}
{name: "x-insert-multi-value", value: "first,second"}
{name: "x-config-variable-connect" value: "before {$$config.connect.val} after"}
{name: "x-context-value-connect", value: "before {$$context.val} after"}
]
}
selection: "id name"
)
me: User @connect(
source: "json"
http: { GET: "/users/{$$config.id}" }
selection: """
id
name
username
"""
)
user(id: ID!): User
@connect(
source: "json"
http: {
GET: "/users/{$$args.id}"
headers: [
{name: "x-from-args" value: "before {$$args.id} after"}
]
}
selection: """
id
name
username
"""
entity: true
)
posts: [Post]
@connect(
source: "json"
http: { GET: "/posts" }
selection: "id title user: { id: userId }"
)
}
type User @key(fields: "id") {
id: ID!
name: String
username: String
nickname: String
@connect(
source: "json"
http: {
GET: "/users/{$$this.id}/nicknames"
headers: [
{name: "x-from-this" value: "before {$$this.id} after"}
]
}
selection: "$.first"
)
c: String @external
d: String
@requires(fields: "c")
@connect(
source: "json"
http: { GET: "/users/{$$this.c}" }
selection: "$.phone"
)
}
type Post {
id: ID!
title: String
user: User
}
scalar JSON
graphql:
routing_url: https://localhost:4001
schema:
sdl: |
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.7"
import: ["@key"]
)
type User @key(fields: "id") {
id: ID!
c: String
}