在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):atlassian-labs/nadel开源软件地址(OpenSource Url):https://github.com/atlassian-labs/nadel开源编程语言(OpenSource Language):Kotlin 99.2%开源软件介绍(OpenSource Introduction):Nadel: A distributed GraphQL engineNadel is a Kotlin library to combine several GraphQL services together. This is achieved by combining several underlying GraphQL services (schemas) into one schema (overall schema). The main purpose of this library is to power a GraphQL gateway which serves as the entry point for executing requests across different services while presenting one GraphQL API. Features
ExampleLet's assume we have two services: "Issues" and "Users". One has exposes issues and one has users. An This is the schema for the Issues service: type Query {
issues: [Issue]
}
type Issue {
id: ID
authorId: ID
} And this is the Users service: type Query {
users(ids: [ID]): [User]
}
type User {
id: ID
fullName: String
} You can define a combined Nadel schema as follows. # In Issue.nadel
type Query {
issues: [Issue]
}
type Issue {
id: ID
author: User @hydrated(
# This fetches users in batches
field: "users"
arguments: [{ name: "ids" value: "$source.authorId" }]
inputIdentifiedBy: [{ sourceId: "authorId" resultId: "id" }]
)
}
# In User.nadel
type Query {
users(ids: [ID]): [User]
}
type User {
id: ID
name: String @renamed(from: "fullName")
} The result is a new GraphQL API which combines the two services in one and has the following schema: type Query {
issues: [Issue]
users(ids: [ID]): [User]
}
type Issue {
id: ID
authors: [User]
}
type User {
id: ID
name: String
} The outside world does not know about the transformations applied by Nadel. It can simply query the data and Nadel will
handle the rest e.g. under the hood Nadel will invoke Users for You can visit our test fixtures folder for many more examples. Dev setupIn order to run the tests from |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论